Learning PHP and MySQL

Example 15-3 Using preg_match to return an array of matches that start with ple

<?php
$subject  
=  "example";
$pattern  =  '/^ple/';
preg_match($pattern,  $subject,  $matches);
print_r($matches);
?>

This code displays:

Array  (  )

Posted by on 09/27 at 11:10 AM

Next entry: Example 15-4 Displaying an error from PHP and redisplaying the form with submitted values

Previous entry: Example 15-2 The file source.js contains functions to check the various fields

<< Back to main