i have an the following string from my database:
";5;78;27;56;66;71;"
how can I extract / explode into variables
$a = "5";
$b = "78";
$c = "27";
thank you for your help!
i have an the following string from my database:
";5;78;27;56;66;71;"
how can I extract / explode into variables
$a = "5";
$b = "78";
$c = "27";
thank you for your help!
Reference: http://us1.php.net/explode
$data = ";5;78;27;56;66;71;";
$dataArr = explode(';',$data);
for($i = 0; $i < count($dataArr); $i++){
${'var'.$i} = $dataArr[$i];
}
Explode should return an array of values. Then you iterate through said values and dynamically assign a name to each one.
In my example code, you'll get $var1, $var2, $var3 and so on.