note 67911 deleted from function.array-key-exists by felipe

From: Date: Sun, 30 Dec 2007 20:53:36 +0000
Subject: note 67911 deleted from function.array-key-exists by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-134542@lists.php.net to get a copy of this message
Note Submitter: marzetti.marco at gmail.com ---- Returns the keys in $arr matching $pattern in a regex <?php function regex_array_keys ( &$arr, $pattern ) { $results[] = false; if( !is_array( $arr ) ) return false; while( !is_null( $key = key( $arr ) ) ) { if( preg_match( $pattern, $key ) ) $results[] = $key; next($arr); } reset( $arr ); return $results; } ?>

« previous php.notes (#134542) next »