I was trying to find a way on how to get the values from print_r(), I already typed-in the same scenario looking for the same problem and answers but only to find out answers that will only print the values and not the way of using it.
let say:
$scontain = "SELECT id FROM voting";
$qcontain = mysql_query($scontain);
$r_idarray = array();
while ($rcontain = mysql_fetch_array($qcontain))
{
$r_idarray[] = $rcontain['id'];
}
here was the print_r():
print_r($r_idarray);
the output of this if it will be printed:
Array([0]==>1 [0]==>5)
What I want to do is to get the values like 1 and 5 and put it in a variable like let say $box and whenever i use $box it will contain 1 and 5 or more values.
my objective was to put $box in the if else condition like:
if(1 == $box)
{
echo "1 is equal to ".$box;
}
else
{
echo "1 is not equal to ".$box;
}
in here $box will be able to give all it contains for comparison. Is it possible or are there any other way which will do the same. Thank you very much.