+ 1
Example is wrong?
I am trying this lesson with <?php $name = 'John'; $ age = 25; echo $name; // Outputs 'John' ?> I am typing information similar with the same exact formula but keeps coming out as an error even if I copy and past the example to my own code to see what happens. The script output keeps coming out as unable to be displayed. I've never had this issue before, please fix this lesson/example Sololearn, I am typing it as if it was the same information and no matter whether I copy and paste or type it freshly with my photographic memory as I did before and nothing will help it be displayed the correct way without this error message harassing me.
8 Respuestas
+ 7
If you have the space between $ and age as shown above, remove it and the code should run. Or just try:
<?php
$name = 'John';
echo $name;
?>
+ 4
Hard to say what is wrong,
show the code you made.
+ 2
If the file is pure PHP code then the closing tag ?> isn't required but is optional. If you're mixing your code with HTML then you'll need to close each PHP portion within the file.
+ 2
I thank all of you, I am returning to coding after 4 years when I gave it up because I was working part time and in school full-time. I love php, if I didn't why would I be asking so many questions to a great community with lots of potential. I am retaking the course as we speak but I am also taking bits and pieces I need into the try it yourself sessions, memorizing it all over again and am coding from scratch without using the original code the tutorial provided. I am getting better every day. You can say I am an old-timer when it comes to coding but my skills are like that of a novice because I didn't use it so it was very easy to lose it.
+ 1
Yes they can be as long as needed.
+ 1
No errors so far.
<?php
$name = 'Jacob';
$age = 22;
echo $name;
// Outputs 'Jacob'
?>
Do I have to end the php tag after I finish each part?
0
You have a space between $ and age
- 1
Nah, there was no space but I had to adjust it a bit for it to work, can php files be long?