note 112388 added to function.array-push

From: Date: Tue, 11 Jun 2013 00:07:16 +0000
Subject: note 112388 added to function.array-push
Groups: php.notes 
Request: Send a blank email to php-notes+get-195124@lists.php.net to get a copy of this message
i wanted to do some string manipulation on a specific field from an sql result set and then append the row to the end of an array like this. [0] => [one] => [val1] [two] => [val2] [three] => [val3] [four] => [val4] [0] => [one] => [val1] [two] => [val2] [three] => [val3] [four] => [val4] ~I tried array push and couldnt get it sorted, So what i did was this. while ($row = mysql_fetch_assoc($query)) { $row['five'] = str_replace('.','',$row['place']); $results[] = $row; } resulting in [0] => [one] => [val1] [two] => [val2] [three] => [val3] [four] => [val4] [five] => [val5] [0] => [one] => [val1] [two] => [val2] [three] => [val3] [four] => [val4] [five] => [val5] ---- Server IP: 69.147.83.199 Probable Submitter: 31.185.235.34 ---- Manual Page -- http://php.net/manual/en/function.array-push.php Edit -- https://master.php.net/note/edit/112388 Del: integrated -- https://master.php.net/note/delete/112388/integrated Del: useless -- https://master.php.net/note/delete/112388/useless Del: bad code -- https://master.php.net/note/delete/112388/bad+code Del: spam -- https://master.php.net/note/delete/112388/spam Del: non-english -- https://master.php.net/note/delete/112388/non-english Del: in docs -- https://master.php.net/note/delete/112388/in+docs Del: other reasons-- https://master.php.net/note/delete/112388 Reject -- https://master.php.net/note/reject/112388 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#195124) next »