Page 1 of 1

meaning of '=>'

Posted: Sat May 24, 2003 9:11 pm
by father
I am creating an array like this

$prices = array ('tires'=>100, 'oil'=>100, 'spark plugs'=>4 );

or like this

$prices['tires']=100;
$prices['oil']=10;
$prices['spark plugs']=4;


first one I specificy the '=>' in the other way I can just use '='

Not sure what '=>' is suppose to do more? then just '='
Going through my php book I don't have a '=>' operator

I have '<=' and '>='

Is '=>' not an operator?

Thanks

Posted: Sun May 25, 2003 12:18 am
by AVATAr
in:

Code: Select all

$prices = array ('tires'=>100, 'oil'=>100, 'spark plugs'=>4 );
"=>" means... key with value .. with that symbol you asign a value to a key. its not an operator.

when you asign values one by one, you make this:

Code: Select all

$prices&#1111;'key'] = 'value';
here you asign array with some key the value you want... check this out http://www.php.net/types.array

Posted: Sun May 25, 2003 12:50 am
by father
K, thx for that!