note 33876 added to ref.array

From: Date: Thu, 10 Jul 2003 00:12:35 +0000
Subject: note 33876 added to ref.array
Groups: php.notes 
Request: Send a blank email to php-notes+get-51810@lists.php.net to get a copy of this message
here are useful functions for submitting a PHP array to a simple text field in mySQL (or other) and then pulling it back into an array (hash friendly)... at this point, it's only 1 demensional... function file_2string($array) { $vals=array_values($array); $keys=array_keys($array); $x=0; while($x<count($keys)) { if ($x!=0) { $result.="|"; } $result.=$keys[$x]."=".$vals[$x]; $x++; } return $result; } function file_2array($string) { $elements=explode("|",$string); foreach ($elements as $element) { $temp=explode("=",$element); $result[($temp[0])]=$temp[1]; } return $result; } ---- Manual Page -- http://www.php.net/manual/en/ref.array.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+33876 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+33876&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+33876&report=yes

« previous php.notes (#51810) next »