Hi guys... i got this code :

    $cat_arr=$_POST['cat'];

    $i = 0; 
    /
    foreach ($cat_arr as $cat) {
    echo "\$cat_arr[$i] => $cat.\n";
    $i++;

And the result was '$cat_arr[0] => 2. $cat_arr[1] => 5.'.

I would like to ask does this mean that is is equal to this:

    $cat_arr[0] =2;
    $cat_arr[1] =5;

So your question is whether => means the same thing as =. In the world of multi-dimensional arrays, no, they aren't quite the same. However, according to the code you're showing us, '=>' is being literally printed as a result of the echo statement. Literally anything could be printed there. Line 6 could be edited to read echo "\$cat_arr[$i] != $cat.\n"; and then the output would be $cat_arr[0] != 2;

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.