Jump to content

phpbenny

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

phpbenny's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Yeaaah perfect it was my value assignment to the $_SESSION that was wrong as you specified. Thanks alot I missed that totally ;D However the count function can also be used on multi dimensionel arrays, but it will only count the "first" array, which is exactly what I need :-) Also you have the option of specifiying a second option to count so it indeed counts all elements recursively. Again great I will be coming back to this board in the future. to help and be helped. Best regards Benny
  2. Hi Thanks for your suggestion, but that is not what I need. My problem are using count on a session array variable produces the result 0, using count on a "normal" variable as my latest example works fine. Best regards Benny
  3. Hi again Thanks for the help, however according to the PHP manual is should work: http://www.php.net/manual/en/function.count.php Please notice this was working in PHP 4 but moving to PHP 5 I had to change the way session variables are set, instead of "session_register("$var")" it now reads "$_SESSION["$var"]". If I test the session variable by "isset" and "is_array" it validates as true, but using "count" results in 0. And it works fine as long as the variable is not a session variable, no problem. This works fine: <? $k[0][0]=23; $k[1][0]=19; $k[2][0]=6; echo count($k); // results in 3 ?> Best regards Benny
  4. Hi again Thanks but unfortunately this was an example, not a good one I see: Heres a snippet from the real code (modified): $_SESSION['basket'] = array(); $_SESSION["kurv[0][0]"] = 5; $_SESSION["kurv[0][1]"] = 3; $_SESSION["kurv[1][0]"] = 1; $_SESSION["kurv[2][3]"] = 25; If I now: echo count($_SESSION["kurv"]); I get the result 0? Best regards Benny
  5. Hi again I'm sorry let me be more clear: This part worked fine in PHP 4 --- "Before at PHP 4" --- Before I had (shown in a short example): $a[0]=1; $a[1]=3; $a[2]=4; session_register("a"); $items = count($a); // result 3 --- "Before finished" --- --- "After moving to PHP 5" --- After: $a[0]=1; $a[1]=3; $a[2]=4; $_SESSION["a"]; $items = count($_SESSION["a"]); // result 0? --- "End of PHP 5" --- Best regards Benny
  6. Hi again And that is exactly what I have done if you look at the "after" example :-) Best regards Benny
  7. Hi I have the following problem after upgrading from PHP 4 to 5. Before I had (shown in a short example): $a[0]=1; $a[1]=3; $a[2]=4; session_register("a"); $items = count($a); // result 3 After: $a[0]=1; $a[1]=3; $a[2]=4; $_SESSION["a"]; $items = count($_SESSION["a"]); // result 0? Anyone know why its not possible to count this array? I have tested that it is an array and the array contains items? Best regards Benny
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.