having trouble using variable variables in PHP -


I am doing this code from the book and I can not seem to work it

  & lt; Html & gt; & Lt; Top & gt; & Lt; H3 & gt; & Lt; U & gt; PHP Tutorial & lt; / U & gt; & Lt; / H3 & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt ;? Php $ texas = "big"; $ Rhode Island = "small"; $ Statement = "Texas"; Echo "$ statement $ ($ statement) is 
"; $ Statement = "Rhode Island"; Echo "$ statement $ ($ statement) is
"; ? & Gt; & Lt; / Body & gt; & Lt; / Html & gt;

This is the output I get:

Texas Dollar (Texas)

Rhode Island is $ (Rhode Island)

Texas is big

Rhode Island is small

syntax is: $ {$ variable_name} , not $ ($ variable_name) . You have to change your code:

  $ statement = "Texas"; Echo "$ statement $ {$ statement}" 
";

See for more information.



Comments

Popular posts from this blog

python - how we can use ajax() in views.py in django? -

matlab - Using loops to get multiple values into a cell -

python - Sequence Pattern recognition with Pybrain -