Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialShari Staten
11,540 PointsCode Will Not Run...Help Please!
I'm not sure what I did wrong here. Assistance is apreciated and please expain what I did wrong and why what's right is right...
<?php
$name ='Grizabella';
$string_one = "Learning to dispaly \"Hello $name\" to the screen.\n";
$string_one = 'Learning to dispaly "Hello '. $name . '!" to the screen. ' . "\n";
$string_one = 'Learning to dispaly "Hello '. $name . '!" to the screen. ' . "\n";
echo $string_one;
//prepend to a string
$string_one = 'Learning to dispaly ';
$string_one = . = "Hello;
$string_one = . = . $name;
$string_one = .= . '!" to the screen. ';
$string_one = $string_one = . "\n";
$string_one = 'I am ' = $string_one = . "\n";
Peace.
2 Answers
Antonio De Rose
20,885 Pointswhat do you actually want to do
<?php
$name ='Grizabella';
$string_one = "Learning to dispaly \"Hello $name\" to the screen.\n";
$string_one = 'Learning to dispaly "Hello '. $name . '!" to the screen. ' . "\n";
$string_one = 'Learning to dispaly "Hello '. $name . '!" to the screen. ' . "\n";
echo $string_one;
//prepend to a string
$string_one = 'Learning to dispaly ';
$string_one = . = "Hello; // where are the finished quotes
$string_one = . = . $name; // you cannot concatenate like this , it will have to be, $string_one .= $name
$string_one = .= . '!" to the screen. '; // do the same as aboe
$string_one = $string_one = . "\n"; // do the same
$string_one = 'I am ' = $string_one = . "\n"; // do the same
Antonio De Rose
20,885 Pointshello, where did you try running your code, when you say console, I am a bit less informative. was it in the workspace, your terminal ??
Shari Staten
11,540 PointsDeveloper tools in the browser.
Shari Staten
11,540 PointsNevermind. I found the error. I neglected a " in one of the code lines. I'm groovy now. Thank you!
Shari Staten
11,540 PointsShari Staten
11,540 PointsMy code will not run in the console.