PHP Pointers Problem (While)

Code with C | Programming: Projects & Source Codes Forums PHP PHP Pointers Problem (While)

This topic contains 2 replies, has 1 voice, and was last updated by  ShikhaTan 2 years, 2 months ago.

  • Author
    Posts
  • #10929

    Maxim6m0cj
    Member

    i’ve problem with PHP. i want learning PHP and i read books, watching tutorials and i wrote this code by myself;

    why this code not working ? please help me.

  • #10930

    Ganesh
    Member

    Use a foreach loop to iterate through an array…

  • #10931

    ShikhaTan
    Member

    you should use foreach to loop over arrays, however, to answer your question as to why your code isn’t working:

    In PHP the integer 0 is falsy, the first element in your array is 0 so the while loop never executes (because the first condition is false), you would need to do a type-sensitive comparison to use while:

    Definitely use foreach though.

You must be logged in to reply to this topic.