Page 1 of 1

=> <---- What is it?

Posted: Sat Oct 12, 2002 11:36 am
by Zoram
I'm new to programming and have seen the '=>' used and was wondering : What is it?

Posted: Sat Oct 12, 2002 11:40 am
by conthox
$a => $b

means that

$a is greater than or equal to $b

Posted: Sat Oct 12, 2002 11:49 am
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.

Posted: Sat Oct 12, 2002 11:53 am
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);

Posted: Sat Oct 12, 2002 12:45 pm
by conthox
Ok, I had wrong.. :oops:

Thank you for telling me.