There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply () below.
If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.
Join the Discussion. Help a fellow learner on their journey.
Ask or answer a question about this exercise by clicking reply () below!
Agree with a comment or answer? Like () to up-vote the contribution!
Hi everyone!
I’m sort of got stuck. Either this or there is some error, as the topic is quite easy.
Task 3 about concatenating four strings "\n" , "tur" , "duck" , and "en"
I put the semicolon at the end. Used another \ before \n so that the system would perceive it as a string and of course added three points between them. The result ‘Did you print the four strings concatenated?’ Yep, definitely. I used different options: with additional spaces like this ’ ', with spaces before and after strings, without spaces, with commas between strings. So I would highly appreciate it if anyone could give me a hint about what I’m doing wrong?
Thank you.) That hepled ) I just misunderstood the task.
I thought, that I should have made \n to be perceived as a text and be printed together with other strings, hence I added another backslash. I got the result I wanted, but it wasn’t right )
The quotes around en were fine in the code. I guess it changed automatically, when I pasted it here.
But in the next codings I’ll be careful with quotes as well.
Thanks ))
hello
I am an aspirant for learning PHP language
I got a doubt
“why do we need to type “echo” every time we want a string of words or something like that??”
echo is a language construct, and was simply the chosen keyword for outputting things.
Other languages have print, printf, println, Console.WriteLine, DISPLAY, console.log, puts, fmt.Println, System.out.println, Write, say … among others.
Well, simply because PHP will not allow you to do that.
However, there are ways to do what you want to do using only one echo
On one line, or multiple lines.
<?php
echo "I like Codecademy" . " I like PHP " . "I like echo";
?>
<?php
echo "I like Codecademy\n" . "I like PHP\n" . "I like echo";
?>
<?php
echo "
I like Codecademy
I like PHP
I like echo
";
?>
Use echo to print a final portmanteau by concatenating these four strings "\n" , "tur" , "duck" , and "en" . Make sure to include a semicolon after the statement.