=> <---- What is it?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Zoram
Forum Contributor
Posts: 166
Joined: Sun Aug 18, 2002 3:28 pm
Location: Utah
Contact:

=> <---- What is it?

Post by Zoram »

I'm new to programming and have seen the '=>' used and was wondering : What is it?
conthox
Forum Commoner
Posts: 39
Joined: Tue Jun 25, 2002 1:44 pm
Location: Sweden

Post by conthox »

$a => $b

means that

$a is greater than or equal to $b
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

in

Code: Select all

$arr = array('index'=&gt;'value');
it stands for 'index' is mapped to 'value' - read $arr['index'] and you will get (edit:) 'value'.


in

Code: Select all

foreach($arr as $key=&gt;$value)
it tells php not only to assign the value but also the kex/index for each entry.
Last edited by volka on Sat Oct 12, 2002 12:55 pm, edited 1 time in total.
User avatar
hob_goblin
Forum Regular
Posts: 978
Joined: Sun Apr 28, 2002 9:53 pm
Contact:

Post by hob_goblin »

conthox wrote:$a => $b

means that

$a is greater than or equal to $b
nope, that's >=

volka had it right, it's dealing with arrays

Code: Select all

$arr = array(
	'abc' => 'value',
	'def' => 'value',
	'ghi' => 'value'
	);

	echo '<pre>';
foreach($arr as $key => $value)&#123;
	echo $key." - ".$value."\n";
	&#125;
	echo '</pre>';

print_r($arr);
conthox
Forum Commoner
Posts: 39
Joined: Tue Jun 25, 2002 1:44 pm
Location: Sweden

Post by conthox »

Ok, I had wrong.. :oops:

Thank you for telling me.
Post Reply