Hi, I'm pretty new to php, I've been learning a lot of it on my own, and I have a question that I haven't been able to find an answer to, so I figured I would ask here.

I've noticed in the php forums, php topsites, and other php of that sort, that there is a lot of {VariableName} being used. For example, in PHPBB3, one of the files uses this: {S_TIMEZONE}

Could someone explain to me how variables with { } work? I've searched every file that comes in php systems like that, and I don't seem to find S_TIMEZONE anywhere (using that as an example still). So I'm pretty confused as to where they get {S_TIMEZONE} from.

    {S_TIMEZONE} is not a variable. {$_TIMEZONE} would be a variable in "complex variable notation", which can be useful when using a variable within a double-quoted string literal or a heredoc string literal to ensure that the parser recognizes where the variable name begins and ends.

    $variable = " a variable ";
    echo "Here is{$variable}in the middle of a string.";
    
    $array = array('key' => 'value');
    echo "Here is an array {$array['key']} in the middle of a string.";
    
      NogDog wrote:

      {S_TIMEZONE} is not a variable. {$_TIMEZONE} would be a variable in "complex variable notation", which can be useful when using a variable within a double-quoted string literal or a heredoc string literal to ensure that the parser recognizes where the variable name begins and ends.

      I think in this case with those {UPPERCASE}
      these are template tokens.
      These {LABELS} are replaced with real values, by the phpBB3 Template engine.
      To produce current pages, for example with user local timezone: {S_TIMEZONE}

      Most these files are in /styles/xxxx/ directory.
      Also some Admin templates in /adm/style/

      I know a bit, because I just did a download + test install (using SQLite 2 database)
      of
      phpBB 3.0.1 Release Candidate 1

      .. released at 2008-03-24 ....... 1 week ago

      Regars 🙂
      halojoy

        Well what would you call something like I described above, thats used in a lot of php programs now a days? (again: {S_TIMEZONE} is my example, I didn't mean {$_TIMEZONE}).

          halojoy wrote:

          I think in this case with those {UPPERCASE}
          these are template tokens.
          These {LABELS} are replaced with real values, by the phpBB3 Template engine.
          To produce current pages.

          Most these files are in /styles/xxxx/ directory.
          Also some Admin templates in /adm/style/

          I know, because I just did a download + test install (using SQLite 2 database)
          of phpBB 3.0.1 Release Candidate 1
          .. released at 2008-03-24 ....... 1 week ago

          Regars 🙂
          halojoy

          Ah I see, thank you. Thats what I was looking to find out.

            Write a Reply...