Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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,882 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,882 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!