Thread: array problems

  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Rep Power
    if sure would be nice to be able to do this

    echo "$tmpdata[$count + 1]<br>n";
    echo "$tmpdata[$count + 2]<br>n";
    echo "$tmpdata[$count + 3]<br>n";
    echo "$tmpdata[$count + 4]<br>n";

    insted of

    $old_count = $count;
    echo "$tmpdata[$count]<br>n";
    echo "$tmpdata[$count]<br>n";
    echo "$tmpdata[$count]<br>n";
    echo "$tmpdata[$count]<br>n";
    $count = $old_count;

    any other ideas ? am I doing a simple syntax wrong ?
  2. #2
  3. No Profile Picture
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Hong Kong
    Rep Power
    you can use this script:
    echo $tmpdata[$count+1]."<br>n";
    echo $tmpdata[$count+2]."<br>n";
    echo $tmpdata[$count+3]."<br>n";
    echo $tmpdata[$count+4]."<br>n";
  4. #3
  5. Banned (not really)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 1999
    Caro, Michigan
    Rep Power
    If you are using php4.0, you can uses braces around an array in an echo statement to get it to work...

    echo "The value is {$tempdata[$count]}.<BR>n";
    echo "The value is {$tempdata[$count+1]}.<BR>n";
    echo "The value is {$tempdata[$count+2]}.<BR>n";

    ---John Holmes

Similar Threads

  1. Problems calling an array value
    By gursharn in forum PHP Development
    Replies: 4
    Last Post: February 16th, 2004, 12:42 PM
  2. array problems
    By gallafrax in forum PHP Development
    Replies: 2
    Last Post: February 2nd, 2004, 07:52 AM
  3. sort: find duplicate string elements in array
    By sciencelife in forum Java Help
    Replies: 3
    Last Post: January 27th, 2004, 01:29 PM
  4. C++ programming help.
    By Programming1 in forum C Programming
    Replies: 1
    Last Post: January 20th, 2004, 10:47 AM
  5. Problems with array
    By deerslayer in forum Visual Basic Programming
    Replies: 3
    Last Post: December 5th, 2003, 10:59 PM

IMN logo majestic logo threadwatch logo seochat tools logo