note 18881 deleted from function.preg-match by sniper

From: Date: Fri, 17 Oct 2003 03:28:38 +0000
Subject: note 18881 deleted from function.preg-match by sniper
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-58730@lists.php.net to get a copy of this message
Note Submitter: bguillot.NOSPAM@NOSPAM.incoretech.com ---- Quick Note to ease Perl to PHP Translation. preg_match that return an array.... that can be directly sent into a list($r1, $r2, $r3) function preg_match_array( $pattern, $stringtoregex ) { // To Ease Translation from Perl to PHP // In Perl We Use Often ( $a, $b, $c) = ( $stringtoregex ~= // /^(...) (...) (...)$/ ); // Translate this into PHP Code like this // list( $a, $b, $c) = preg_grep_array( // "/^(...) (...) (...)$/", // $stringtoregex); $retarray=array(); preg_match( $pattern, $stringtoregex, $retarray); // Destroy index zero which is the whole string unset( $retarray[0]); return $retarray; }

« previous php.notes (#58730) next »