Help with variables

Ok , so i am learning PHP at http://www.w3schools.com/php/ . I have tried the code $txt = “W3Schools.com”;
echo "I love " . $txt . “!” , in PHP designer 8.1.2 , with php version 5.4.15 , and the code wont work . W3School is teaching php 5 . Can somebody tell me how the code should be written , tell me how to convert all variables from 5 to 5.4.15 , if needed ,tell me the differences between 5 and 5.4.15 , and tell me if W3Scool is a good place to learn PHP from , and if not , please provide a link to a better PHP learning website . Thanks , and have a good day .

PHP5 encompass all php5 flavors.

When you say it doesn’t work, what does that mean? I don’t know what you’re doing or how you are getting there, so I can’t point out what is happening.

$txt = “W3Schools.com”;
echo "I love " . $txt . “!”
This is the code that does not work . Php desgner lights up this line red , and when hovering over it it says " parse error : syntax error , unexpected ‘$txt’ (T_VARIABLE), expecting’,’ or ‘;’ .
What did i do wrong ?
Am i just dumb , and the answer is obvious , or is there a difference between those 2 versions of PHP ?

Assuming the code you’ve posted here is the entire code it seems it’s just a not-so-good error message produced by the IDE.

[php]<?php
$txt = “W3Schools.com”;
echo "I love " . $txt . “!”; // <-- missing this semi colon[/php]

I have litterally copy-pasted your code , and it still gives the same error . Is PHPDesigner 8 bugged ?

Without the comment , of course .

Outside of what the IDE says, does the code work in you server?

Would seem so, never tried (or heard of) PHPDesigner so no real suggestion there. Perhaps try another editor? Netbeans is free. You can try PHP on different version here:

Shouldn’t make any difference

Thanks . It works . Thank you for your time .

Sponsor our Newsletter | Privacy Policy | Terms of Service