Re: If the first four characters are "0000", then do {}

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jan 25, 2010 at 21:36, John Taylor-Johnston
<John.Taylor-Johnston@xxxxxxxxxxxxxxxxxxxxx> wrote:
> I am reading the manual: http://ca.php.net/manual/en/ref.strings.php
>
> $mydata->restored = "0000-00-00";

<?php

$o[] = '0942-23-23';
$o[] = '0000-00-00';
$o[] = '1238-00-00';
$o[] = '0001-23-45';
$o[] = '0000-11-22';

for($i=0;$i<count($o);$i++) {
        if(preg_match('/^[0]{4,}\-/U',$o[$i])) {
                echo "Offset #".$i." matches: ".$o[$i].PHP_EOL;
        }
}
?>

-- 
</Daniel P. Brown>
daniel.brown@xxxxxxxxxxxx || danbrown@xxxxxxx
http://www.parasane.net/ || http://www.pilotpig.net/
Looking for hosting or dedicated servers?  Ask me how we can fit your budget!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux