SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Dec 2005
    Posts
    191
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    eval() and variable inside a variable problem

    Hi guys,

    Can't seem to get this to work, any ideas what i'm doing wrong!!
    Not too sure what i'm doing on this one and if i'm on the right lines..

    PHP Code:
    echo eval("$".$type."_day"); 
    Thanks,
    Dave

  2. #2
    @php.net Salathe's Avatar
    Join Date
    Dec 2004
    Location
    Edinburgh
    Posts
    1,396
    Mentioned
    54 Post(s)
    Tagged
    0 Thread(s)
    You likely don't even need to use eval:
    PHP Code:
    echo ${$type '_day'}; 
    Salathe
    Software Developer and PHP Manual Author.

  3. #3
    SitePoint Zealot
    Join Date
    Dec 2005
    Posts
    191
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah yes works like a charm!
    Ill have to change everything back now !

    Many thanks.


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
  •