So i have this php:
<?php
if (isset($_COOKIE["currentsearchctrl"])) {
$cookz = $_COOKIE["currentsearchctrl"];
$data = explode(';', $cookz, -1);
$newdata = array();
foreach($data as $value){
$newdata[] = explode(':', $value, -1);
}
print_r($newdata);
} else { }
?>
The cookie that is being read by php:
%20Rod%20Stewart%20%3A%2059088763306%3B%20Led%20Zeppelin%20Official%20%3A%20131572223581891%3B%20Lynyrd%20Skynyrd%20%3A%206983887641%3B%20Black%20Sabbath%20%3A%2056848544614%3B
but the ‘print_r’ is outputting:
Array ( [0] => Array ( [0] => Rod Stewart ) [1] => Array ( [0] => Led Zeppelin Official ) [2] => Array ( [0] => Lynyrd Skynyrd ) [3] => Array ( [0] => Black Sabbath ) )
The ‘id’ is missing. I needed it to be. Array([0] => Array ([0] => Rod Stewart, [1] => 1200420 ) [1] => Array ( [0] => Led Zeppelin Official, [1] => 110024294 )…
To help, this is the output of print_r($data):
Array ( [0] => Rod Stewart : 59088763306 [1] => Led Zeppelin Official : 131572223581891 [2] => Lynyrd Skynyrd : 6983887641 [3] => Black Sabbath : 56848544614 )
Could someone help?
Why don’t you try with regular expressions?
EDIT: Sorry I didn’t notice the name wasn’t complete
Example: preg_match_all