note 108515 added to function.preg-match-all

From: Date: Thu, 03 May 2012 04:56:00 +0000
Subject: note 108515 added to function.preg-match-all
Groups: php.notes 
Request: Send a blank email to php-notes+get-187451@lists.php.net to get a copy of this message
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. ---- Server IP: 69.147.83.197 Probable Submitter: 62.1.225.183 ---- Manual Page -- http://www.php.net/manual/en/function.preg-match-all.php Edit -- https://master.php.net/note/edit/108515 Del: integrated -- https://master.php.net/note/delete/108515/integrated Del: useless -- https://master.php.net/note/delete/108515/useless Del: bad code -- https://master.php.net/note/delete/108515/bad+code Del: spam -- https://master.php.net/note/delete/108515/spam Del: non-english -- https://master.php.net/note/delete/108515/non-english Del: in docs -- https://master.php.net/note/delete/108515/in+docs Del: other reasons-- https://master.php.net/note/delete/108515 Reject -- https://master.php.net/note/reject/108515 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#187451) next »