Text lines numeration:
<?PHP
// Multieline text:
$Text = "
Some
Multieline
text
for
numeration";
// For count:
$GLOBALS["LineNUMBER"] = 1;
// Replace linestart on number:
PRINT preg_replace_callback("/^/m",function ()
{
return $GLOBALS["LineNUMBER"]++." ";
},
$Text);
?>
1
2 Some
3 Multieline
4 text
5 for
6 numeration