note 108515 deleted from function.preg-match-all by danbrown

From: Date: Thu, 10 May 2012 16:51:02 +0000
Subject: note 108515 deleted from function.preg-match-all by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-187601@lists.php.net to get a copy of this message
Note Submitter: Charalampos Tsimpouris ---- I found the turn_array in a previous post, however this function will destroy records that have names from <?Pname> identifiers. A better function would be: <?php function turn_array($m, $remove_numeric = FALSE) { $rt = array(); foreach($m as $col_id => $col_data) { if (is_numeric($col_id) && $remove_numeric == TRUE) continue; foreach($col_data as $row_id => $row_data) { $rt[$row_id][$col_id] = $row_data; } } return $rt; } ?> If your reg expression has only named records, then set $remove_numeric to TRUE to remove all numeric ones.

« previous php.notes (#187601) next »