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

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -