Is inserting a variable into this statement possible?

Discussion in 'PHP' started by FretLessBass, May 22, 2007.

  1. #1
    Hello PHP coders,

    I'm not that great at PHP - just mangle it really. Could you tell me how to get this to work?

    This is my main statement

    
    echo GetSR($SILO='Static Text');
    
    PHP:
    GetSR is my custom funtion which returns a string.

    But I want to replace "Static Text" with text that is available in a variable. So let's say that variable is $NewSILO, how can I get it into that statement so that it can be assigned to $SILO and echoed? The variable may have a different value everytime it's run and I'd really like to pass it to GetSR.

    Any help would be much appreciated.

    FretLessBass
     
    FretLessBass, May 22, 2007 IP
  2. rgchris

    rgchris Peon

    Messages:
    187
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Can you just do this:

    $SILO = $newvariable;
    
    echo GetSR($SILO);
    PHP:
    Or am I misreading what you mean?
     
    rgchris, May 22, 2007 IP
  3. FretLessBass

    FretLessBass Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    So simple - exactly what I needed.

    Thank you very much. :D

    FretLessBass
     
    FretLessBass, May 22, 2007 IP