How to force php to don't read $text$ as a variable ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • fuchsia555
    New Member
    • Dec 2009
    • 56

    How to force php to don't read $text$ as a variable ?

    how to force php to don't read this >> $text$ as a variable ? and just print it to HTML code as it $text$

    when i try to add $text$ it doesn't appear in html source because php read it as a variable how to disable just this certain word >>> $text$
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    Hey.

    PHP only parses variables in double-quoted strings, not single-quoted strings. And you can always use the back-slash (\) to escape the $ char in double-quoted strings if you need it printed rather than parsed.
    [code=php]
    // Here PHP will parse the variable and
    // replace it with it's value.
    echo "Text: $text";

    // But not in either of these.
    echo "Text: \$text";
    echo 'Text: $text';
    [/code]

    Comment

    • fuchsia555
      New Member
      • Dec 2009
      • 56

      #3
      Thanks

      Thanks Atli it was useful answer

      Comment

      Working...