Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Dec 2006
    Posts
    306
    Thanks
    24
    Thanked 0 Times in 0 Posts

    why i could not print value?

    Hi:
    why my following code could not print out value?

    PHP Code:
    $mystring="nationalize running going";

    $mystr split(" ",$mystring);
    $max=sizeof($mystr);

    $i=0;
    while(
    $i<$max){
       echo 
    $mystr[i];
       
    $i++;


  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    You should be getting an error. You used i in your while loop instead of $i.
    PHP Code:
    echo $mystr[$i]; 
    Turn on error_reporting in the development stage. Put this at the top of your php.
    PHP Code:
    error_reporting(E_ALL); 
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    Regular Coder
    Join Date
    Dec 2006
    Posts
    306
    Thanks
    24
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by _Aerospace_Eng_ View Post
    You should be getting an error. You used i in your while loop instead of $i.
    PHP Code:
    echo $mystr[$i]; 
    Turn on error_reporting in the development stage. Put this at the top of your php.
    PHP Code:
    error_reporting(E_ALL); 
    Thanks a lot.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •