Jump to content

What do these mean?


JC99

Recommended Posts

Hey all, I'm new to these forums and have decided to learn PHP.  I have 2 questions.

 

What does => mean?

What does -> mean?

 

I bought the book "Programming PHP" published by O'Reilly and was just flipping through it but I can't find the definition of -> and => in the book even though they are used in code examples throughout the book. Can someone explain these two things to me.

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/163729-what-do-these-mean/
Share on other sites

The expression "=>" that's normally used in some-kind of if statement. and it means for example

 

 

$variable1 => $variable2

 

which means varriable2 is either equal or less than variable1.

 

The expression "->" looks like object oriented programming to me but I could be wrong. I don't use OOP normally. But in OOP it goes after a variable for example " $variable->status" But I could be wrong but I'm certain about the first one.

Link to comment
https://forums.phpfreaks.com/topic/163729-what-do-these-mean/#findComment-863938
Share on other sites

I guess I have to read up on arrays and classes.

 

Thanks guys

Here's a little bit of a better explanation:

 

$array = Array('something' => 'value');
echo $array['something']; // 'value'

 

Key => Value, Key is the name by which you'll be accessing that element of the array. And the value is well, the value of that element.

Link to comment
https://forums.phpfreaks.com/topic/163729-what-do-these-mean/#findComment-863950
Share on other sites

The expression "=>" that's normally used in some-kind of if statement. and it means for example

 

 

$variable1 => $variable2

 

which means varriable2 is either equal or less than variable1.

 

I am a little confused. So does this mean >= and => are interchangeable?

 

No, => is used in arrays. >= would be used in a conditional statement.

Link to comment
https://forums.phpfreaks.com/topic/163729-what-do-these-mean/#findComment-863954
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.