confusion about regular expressions in php
Posted: Sun Jan 24, 2016 4:14 am
Can anybody explain me about the following code.
The following code
<?php
$a = 'first line
second line
';
$b = '/l...$/';
$match = preg_match_all($b,$a,$matches);
print_r($matches);
?>
is showing the output
Array ( [0] => Array ( ) )
instead of
Array ( [0] => Array ( [0] => line ) )
But the following code
<?php
$a = 'first line
second line
';
$b = '/l....$/';
$match = preg_match_all($b,$a,$matches);
print_r($matches);
?>
is showing
Array ( [0] => Array ( [0] => line ) )
instead of
Array ( [0] => Array ( ) )
Can anyone explain me why it is working in reverse order in my computer?
The following code
<?php
$a = 'first line
second line
';
$b = '/l...$/';
$match = preg_match_all($b,$a,$matches);
print_r($matches);
?>
is showing the output
Array ( [0] => Array ( ) )
instead of
Array ( [0] => Array ( [0] => line ) )
But the following code
<?php
$a = 'first line
second line
';
$b = '/l....$/';
$match = preg_match_all($b,$a,$matches);
print_r($matches);
?>
is showing
Array ( [0] => Array ( [0] => line ) )
instead of
Array ( [0] => Array ( ) )
Can anyone explain me why it is working in reverse order in my computer?