Jump to content

Recommended Posts

also as a condition

 

> means greater than

< means less than

= means the same as

so u can use

 

=< means equal to or less than

=> means equal to or more than

its a way of setting a dividing line

 

example

 

$a = '????';

$b = '10';

 

if ($a => $b)

$answer = ''yes;

else

$answear = 'no';

 

if $a is less than 10 then $b returns 'no'

if %a is 10 or more then $b returns 'yes'

Link to comment
https://forums.phpfreaks.com/topic/234725-what-does-mean/#findComment-1206268
Share on other sites

The => operator is, perhaps confusingly, called a "double arrow" (the token name that PHP sees is T_DOUBLE_ARROW).  It is used in two places, neither being anything directly related to objects or OOP.

 

[*]When assigning keys to be associated with array values

 

$fruits = array('a' => 'apple', 'b' => 'banana');

 

 

[*]When retrieving the key in a foreach loop

 

foreach ($fruits as $key => $value) {

 

Link to comment
https://forums.phpfreaks.com/topic/234725-what-does-mean/#findComment-1206410
Share on other sites

The => operator is, perhaps confusingly, called a "double arrow" (the token name that PHP sees is T_DOUBLE_ARROW).  It is used in two places, neither being anything directly related to objects or OOP.

 

[*]When assigning keys to be associated with array values

 

$fruits = array('a' => 'apple', 'b' => 'banana');

 

 

[*]When retrieving the key in a foreach loop

 

foreach ($fruits as $key => $value) {

 

 

Very defined formulation! How would you define -> ? When using for example $this->post_id

 

I know how to use it but I don't really know how to define or explain it to somebody, and I think that shows that I don't fully understand it.

 

 

Link to comment
https://forums.phpfreaks.com/topic/234725-what-does-mean/#findComment-1206492
Share on other sites

Very defined formulation! How would you define -> ?

 

That is the "object operator" or, more colloquially, the "arrow operator".  Its token name when PHP parses your code into pieces is T_OBJECT_OPERATOR.

And in which situations exactly is it used?

When you're using/assigning an objects properties/methods. Its all in the manual.

Link to comment
https://forums.phpfreaks.com/topic/234725-what-does-mean/#findComment-1206606
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.