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 trial

PHP

Code 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
Antonio De Rose
20,884 Points

what 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

My code will not run in the console.

Antonio De Rose
Antonio De Rose
20,884 Points

hello, where did you try running your code, when you say console, I am a bit less informative. was it in the workspace, your terminal ??

Developer tools in the browser.

Nevermind. I found the error. I neglected a " in one of the code lines. I'm groovy now. Thank you!