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
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
Share on other sites

I thought "equal to or less than" was <=

and that "equal or greater than" was >=

 

I wanted to know about =>

They pretty much covered it. => in arrays key => value.

 

-> Is used (not only in PHP) as a pointer. Example: class->method();

Link to comment
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
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?

Link to comment
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.