regular expression — PHP

commandline session

<?php
$text = “Hello World”;
if ( preg_match( “/r.*?d/”, $text, $array ) ) {
print “<pre>n”;
print_r( $array );
print “</pre>n”;
}
?>

note: preg_match — Perform a regular expression match
source : www.phpcode.net

OUTPUT

$ 4.2.36 13 513—> php rep.php
PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/lib/php5/20100525/suhosin.so’ – /usr/lib/php5/20100525/suhosin.so: cannot open shared object file: No such file or directory in Unknown on line 0
<pre>
Array
(
[0] => rld
)
</pre>
$ 4.2.36 14 514—>

Leave a comment

Your email address will not be published. Required fields are marked *