Local host ERROR, PHP tester PERFECT

I just started learning PHP and I am using a book called PHP & MySQL in easy steps by Mike McGrath. I have managed to get to a point where I am wondering if it’s me, or this guys code that’s the problem. while doing a test with the code below, I am getting told on my localhost: Parse error : syntax error, unexpected ‘<’, expecting end of file in C:\Abyss Web Server\htdocs\sort.php on line 33

yet, when I run the code on PHP TESTER is comes up perfect. I am getting very frustrated with this. My testing server is Abyss and using PHP 7. Any ideas?

<?php # Statements to be inserted here. $cars = array( 'Dodge' => 'viper' , 'Chevrolet' => 'Camaro' , 'Ford' => 'Mustang' ) ; echo '
Original Element Order :
' ; foreach( $cars as $key => $value ) { echo ' • ' , $key . ' ' . $value ; } asort( $cars ) ; echo '
Sorted Into Value Order :
' ; foreach( $cars as $key => $value ) { echo ' • ' , $key . ' ' . $value ; } ksort( $cars ) ; echo '
Sorted Into Key Order :
' ; foreach( $cars as $key => $value ) { echo ' • ' , $key . ' ' . $value ; } echo '
' ;

at least you have to use the code-tags provided by the forums editor so anyone can read your code properly.

When you post on this forum, the form field you type in has place-holder text stating you can use Markdown, BBCode, or (some) Html to format what you type. Markdown and BBCode documentation can be found by doing a search on the Web. I personally use BBCode [ code ] your code here… [ /code ] (with no spaces) tags. Edit: which I see you managed to do in the thread you have since deleted.

Sponsor our Newsletter | Privacy Policy | Terms of Service