SitePoint Sponsor

User Tag List

Results 1 to 8 of 8

Thread: parse error

  1. #1
    SitePoint Wizard johnn's Avatar
    Join Date
    Mar 2001
    Location
    Southern California, USA
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    parse error

    PHP Code:
    $i 0;
    $abc{$i}_int = (int)$abc{$i}_int
    and it gives parse error...

  2. #2
    Happy Holidays !! Paul S's Avatar
    Join Date
    Mar 2001
    Location
    Mexico
    Posts
    1,287
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    mm, try this
    PHP Code:
    $i 0;
    $var "$abc{$i}_int";

    $
    $var = (int) $$var
    Paul

  3. #3
    SitePoint Wizard johnn's Avatar
    Join Date
    Mar 2001
    Location
    Southern California, USA
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, Pauls
    PHP Code:
    $i 0;
    $abc0_int 2;
    $var "$abc{$i}_int";
    $
    $var = (int) $$var;

    echo $
    $var
    It displays 0, but it should displays 2

  4. #4
    Happy Holidays !! Paul S's Avatar
    Join Date
    Mar 2001
    Location
    Mexico
    Posts
    1,287
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by johnn
    Thanks, Pauls
    PHP Code:
    $i 0;
    $abc0_int 2;
    $var "$abc{$i}_int";
    $
    $var = (int) $$var;

    echo $
    $var
    It displays 0, but it should displays 2
    ohh, just change thisr $var = "$abc{$i}_int"; for this $var = "abc{$i}_int";

    Paul

  5. #5
    SitePoint Wizard johnn's Avatar
    Join Date
    Mar 2001
    Location
    Southern California, USA
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it displays abc0_int

  6. #6
    Happy Holidays !! Paul S's Avatar
    Join Date
    Mar 2001
    Location
    Mexico
    Posts
    1,287
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by johnn
    it displays abc0_int
    weird, it works for me. Check you are echoing $$var and not $var.
    PHP Code:
    $i 0;
    $abc0_int 2;
    $var "abc{$i}_int";
    $
    $var = (int) $$var;

    echo $
    $var
    Paul

  7. #7
    SitePoint Wizard johnn's Avatar
    Join Date
    Mar 2001
    Location
    Southern California, USA
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oops, it works! (problem is I echo $var instead of $$var) Thank you very much.

  8. #8
    Happy Holidays !! Paul S's Avatar
    Join Date
    Mar 2001
    Location
    Mexico
    Posts
    1,287
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by johnn
    Oops, it works! (problem is I echo $var instead of $$var) Thank you very much.
    You're welcome


Bookmarks

Posting Permissions

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