hi,

Is there a function equivalent to the foreach for PHP3? Maybe there is an easy solution and I'm unaware of it, so any pointers will be helpful

thanks,
-sridhar

    foreach function only supports on php4 version, php3 will not supports this function.

    this syntax

    foreach ($arr as $value) {
    echo "Value: $value<br>\n";
    }

    Rams.

      okay,

      i answered my own question.
      since there is no foreach in php3 you can do this:

      for($i = 0; $i < sizeof($yourarray); $i++) {
      $current_value = $yourarray[$i];
      }

      this is replacing the php4:

      foreach($yourarray as $current_value) {
      }

      hope this help someone other than myself!

      -sridhar

      P.S. Rams: I KNOW that foreach is not supported in php3. That's why I asked for an alternative. but thanks for your response anyway. =)

        6 months later

        Thanks Sridhar,
        Just to let you know that your post helped me out.
        Once again I search Google for an answer and I get it on PHP Builder!
        Well done everybody!

          2 months later

          I also wanted to say thanks for the information I found in this thread. It helped me out quite a bit. Thanks, again.

          Cheers,
          -mcvm

            Thanks from me too. I am a starter, so you helped me not to break my brain this night!

              13 days later
              Write a Reply...