Hi, recently I just started learning php as a complete beginner, and I wrote some codes that wasn't able to show up on my browser. Please check to see if there is anything wrong with it. This is the exactly what I used.

<?php

$prices= array( ‘Tires’=>100, ‘Oil’=>10, ‘Spark Plugs’=>4 );


foreach ($prices as $key => $value)
echo $key.’=>’.$value.’<br />’;

while( $element = each( $prices ) )
{
echo $element[ ‘key’ ];
echo ‘ - ‘;
echo $element[ ‘value’ ];
echo ‘<br />’;
}


?>

Recommended Answers

All 4 Replies

do a find and replace in your script for the following:
replace ‘ with '
replace ’ with '

do a find and replace in your script for the following:
replace ‘ with '
replace ’ with '

wow thank you very much!! I didn't notice that :(

Hi, recently I just started learning php as a complete beginner

after you go through enough wild goose chases, you will learn to look for the stupidest stuff first.

after you go through enough wild goose chases, you will learn to look for the stupidest stuff first.

We all still miss a semicolon now and then. ;)

commented: indeed +2
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.