Click to See Complete Forum and Search --> : what does '=>' mean?


damon2003
12-12-2003, 05:08 AM
Hi, what does this symbol mean?

=>


thanks

Zibings
12-12-2003, 05:40 AM
Well...to be honest, I've never used a command exactly like that...but I can tell you it probably is an operator for something like an IF() statement that means the left operand is greater than or equal to the right operand. In other words:

if ( $var1 => $var2 )
is like
if $var1 is > or = $var2

That help?


PS - I always thought you were supposed to use >=, but gosh golly it's possible I could be crazy.

mitya
12-12-2003, 06:10 AM
The first reply was correct, it is >= for the comparison operator 'greater to or equal than'. But is it possible the first poster was referring to array key application?

The => is used for specifying your own key name for an array value, rather than PHP using its own inherant 0, 1, 2 etc system. So:

$my_array = array("my key" => 'value', "another key" => 'value2');

pyro
12-12-2003, 07:24 AM
mitya is correct. Just remember, if you assign the array keys like that, $my_array[0] will not contain any data, as the only keys that will exist are 'my key' and 'another key'.

Zibings
12-12-2003, 07:58 AM
Well, I'm curious now. Did you mean >= for if()'s and the like, or did you mean from an array?

mitya
12-12-2003, 08:01 AM
If.

>= is the comparison operator

=> is the key allocator in arrays.

damon2003
12-12-2003, 08:01 AM
it was related to arrays yea, not to greater or equal to operators

Zibings
12-12-2003, 08:07 AM
Nooo! I lose!

Curses! Foiled again!