I thought I would post this function I created for others to use.
PHP Code:
<?php
function custom_array($str){
/* Config Options */
$array_prefix = "[:]"; // Custom array start:finish ':' split them up
$array_split = ":"; // Array split (i:0;) ':' splits the key and var
$var_end = ";"; // Var end (i:0;) ';' ends the current var
/* Config Options */
list($as,$af) = split(':',$array_prefix); // Splitting up the array prefix's
if(substr($str,0,1) == $as && substr($str,-1) == $af){ // Checks custom array start/finish
$array = array(); // Starts the array
foreach(split($var_end,substr($str,1,-1)) As $create){ // Extracting each array query
if($create != ""){ // Checks if array vars contain something
list($key,$value) = split($array_split,$create); // Splits custom array vars
if($value != ""){ // Checks if array value contain something
$array[$key] = $value; // Sets array key / value
}
}
}
return $array; // Returns the final array
}
}
$entry = "[i:0;j:23;ii:1;]"; // My custom array string
$entry = custom_array($entry); // array([i] => 0 [j] => 23 [ii] => 1);
print $entry[j]; // returns '23'
?>
Hope people like my function which you can mod to how you want your custom array to look
e.g.
([i::0],[j::23],[ii::1])
__________________
Official
BinPress hand picked coder.
For anyone worried about SQL injection go have a look at my small yet powerful script
here.
Go Pledge for
Light Table, if it hit's $300,000 Python and other languages will get added.
I am 1 of 65,608 people to get a Pebble Watch :P