I have a string $cookie that contains properties and values separated by underscores. I can explode the string to get an array of the property and values and below echo them out...
That will echo out...<?php
$cookie = 'audio.0_backgroundimages._browserpatch.1_chatroom.0_connection.0_css3.0_cursors.0';
$pieces = explode('_', $cookie);
echo $pieces[0].'<br />';
echo $pieces[1].'<br />';
echo $pieces[2].'<br />';
echo $pieces[3].'<br />';
echo $pieces[4].'<br />';
echo $pieces[5].'<br />';
?>
What I'd like to do is have PHP convert each $piece to a variable and the part after each period to be assigned as that new variable's value.audio.0
backgroundimages.
browserpatch.1
chatroom.0
connection.0
css3.0
cursors.0
So the last part above I'd like to essentially look or be in effect like the following...
Suggestions please?$audio = 0;
$backgroundimages = ;
$browserpatch = 1;
$chatroom = 0;
$connection = 0;
$css3 = 0;
$cursors = 0;
- John
Bookmarks