# Operator Precedence

You Can force precedence using parentheses otherwise they are evaluated in this order:

XOR – exclusive or-either a or b is true but not both.

AND is not the same like &&

## For Example:

```<?php
echo \$a && \$b || \$c;
?>
```

is not the same like

```<?php
echo \$a AND \$b || \$c;
?>
```

the first thing is
(a and b) or c

the second
a and (b or c)

because || has got a higher priority than and, but less than &&

## Operators:

Operator are used to perform operation.

Operator are mainly divided by three groups.

1. Unary Operators that takes one values
2. Binary Operators that takes two values
3. Ternary operators that takes three values

Operator are mainly divided by three groups that are totally seventeen types.

## 1. Arithmetic Operator

– Subtraction
* Multiplication
/ Division
% Modulo
** Exponentiation

= equal

## 3. Array Operator

+ Union
== Equality
=== Identity
!= Inequality
<> Inequality
!==     Non-identity

& and
^ xor
| not

## 5. Comparison Operator

==  equal to
=== identical
!=  not equal
!== not identical
<>  not equal
< less than
<= less than or equal
> greater than
>= greater than or equal
<=> spaceship operator

“ back-ticks

## 7. Execution Operator

@ at the rate sign

## 8. Incrementing/Decrementing Operator

++\$a Pre-Increment
\$a++ Post-Increment
– -\$a Pre-Decrement
\$a- – Post-Decrement

&& And
|| Or
! Not
and And
xor Xor
or Or

## 10. String Operator

. concatenation operator
.= concatenating assignment operator

## 11. Type Operator

instanceof instanceof

## 12. Ternary or Conditional operator

?: Ternary operator

## 13. Null Coalescing Operator

??” null coalescing

## 14. Clone new Operator

clone new clone new

## 15. yield from Operator

yield from yield from

yield yield

print print

Happy
0 %
0 %
Excited
0 %
Sleepy
0 %
Angry
0 %
Surprise
0 %

5 Star
33%
4 Star
13%
3 Star
13%
2 Star
26%
1 Star
15%

## 49 thoughts on “PHP – Operator Precedence”

1. You are sso cool! I do noot believe I’ve read a single thing llike tjat before.
So wonderful too discover someone with some uniue
thoughts on thi issue. Really.. tthanks for starting
this up. This site is something that’s needed on the internet, spmeone wkth some originality!

2. nanniekruttschnitt says:

Simply wsh too say your aricle is as surprising. The clearnrss for
yoiur pubnlish is just excellent annd thawt i can thimk you’re aan expert onn thiks subject.
to keep udated wigh imminent post. Thanhks one million annd please keep
up the rewarding work.

3. garlandgaertner says:

Thhis iis a good tip particularly tto those frsh tto the blogosphere.
Brief but very precise information… Thaznk you foor sharikng thhis one.

4. quinton_burgett says:

Hi i am kavin, itss my fist occasin to commentihg
due tto this sensible piesce oof writing.

Thanks to mmy father whoo informed me abojt this website, this blog is actuially awesome.

6. daltonrubino says:

Hi there, I log on to youur blogs lke every week. Your humoristic style iis
awesome, kwep doing what you’re doing!

7. darwinriggs says:

Excellent items from you, man. I hhave takje into account your stjff previous
tto andd you’re just too great. I really like
what you’ve acuired here, really like what yyou are statging and the way
duringg which you say it. You are maing it enjoyable and you continue to take care oof too kesep iit wise.
I can’t wait to read far more from you. Thhat iss reslly a tremendous web site.

8. aureliowedgwood says:

Heey there juust wanted too give you a brief heades upp
and let you know a few of thee pictures aren’t loading properly.

I’m nnot sure why but I think its a linking issue. I’ve tried it in two different
browsers and both sho the sqme results.

9. La scopo e_gli sborro in faccia per_la prima volta!! says:

Hi there i am kavin, itss my first occasion to commenting
anyplace, whern i read ths post i thought i
could also make comment due too this brilliant piec off writing.

10. christinaedman says:

Have you evber thojght avout adding a litrtle
bitt more than jhst your articles? I mean, what yyou say iss undamental
and everything. However jist imaginee iif you added some grwat images or
vikdeo clils tto ive yokur posts more, “pop”! Yoour content iis
excellent butt with imahes andd videos, this site ccould dfinitely be oone of the
vedry best in its field. Great blog!

11. Lewis says:

What’s upp to every , becaause I am genuinely keen oof reading
this webpage’s post to be updated daily. It contains good stuff.

12. 728 says:

Heyy I know thhis iis off topic but I waas wondering if you knew oof any widgets I coul addd tto my blopg
I’ve been looking for a plug-in like thi forr quuite solme
time and was hoping aybe you would have some experience with something like this.

13. Why users still mazke usee of too read news paperss wnen iin this technological world tthe whole thong iis available on web?

14. Spot on woth thus write-up, I seriously believe tis amazig site needs a great
deal more attention. I’ll probably be returning too reazd more, thajks for the info!

15. If some onee needs expert viiew regardng blogging then i suggest him/her to pay a
vidit thijs blog, Keep up the pleasant job.

16. I am really loving the theme/design of your site.
Do you ever run into any internet browser compatibility problems?
A handful of my blog readers have complained about my site not operating correctly.
in Explorer but looks great inn Opera. Do you have?
any advice to help fix this problem?

1. use jQuery and browser compatibility specific CSS codes..

17. Antoinette says:

Hi there, ths weekend is pleassant in support oof me, ass this occasion i
aam reaeing this grea inforrmative post here aat my house.

18. Anonymous says:

Greetings! Thiss iss my forst viksit too your blog! We are a collection of volunteers aand starting a nnew projet
in a conmunity in thee same niche.Your blpg provided uss valpuable information tto wwork
on. You have donne a outstanding job!

19. decided to do homework says:

Rigut here iss the right blg for eeveryone who woul lik to understand this topic.
You realize sso muuch its almost tough to argue wiuth yoou (not that I rreally wll need
to…HaHa). You definitely put a frrsh sin on a topic that haas
been discussed for many years. Womderful stuff, just wonderful!

20. tinyurl.com says:

of thigs from it concerning blogging. thanks.

21. cindashowers says:

Definitely believe that whiich youu said. Your fzvorite reason appeared to be on thhe
net thee easiest thing to bbe aware of. I say tto you, I definitely get
annoyed whhile peoppe thyink about worries that thjey plainly
doo noot kbow about. Yoou managed too hitt thhe nail uon tthe top and defined out the whole ting without having ide
efrect , people can take a signal. Wiill likely bbe back to get more.
Thanks

22. Hunter x Hunter (2011) 06 says:

Hi! I realize tis iis kind of off-topic but I had tto
ask. Does running a well-established webite like
yours taske a lot of work? I’m brand neew to wriiting a blog
but I doo write inn myy journal on a daily basis. I’d like tto start a blog so I cann easipy sare myy owwn experience and views online.
Pldase let me know iff you have any kind of recommdndations or tips foor
brand neww aspiring blog owners. Appreciate it!

23. First time she had bbc says:

Thaat is a grdeat ttip particularly too tthose fresh tto the blogosphere.
Short but ery precise info… Thanmk youu for sharing tjis one.
A must rea post!

24. Good fatcum as dessert says:

It’s very easy too find out aany matter on neet as compared to books, aas
I foun this paragraph at tis site.

25. Anonymous says:

I just couldn’t goo away our web sit beforre suggsting thst
I really enhjoyed the standard information a person provide for your guests?
Is going to be back regularly in ordeer to inspect neww posts

26. claurakiehl says:

Greate article. Keeep writing sudh kind off infortmation onn yokur blog.
Im reallpy imprfessed by it.
Hello there, You’ve performed ann incredible job. I
will definitely digg iit and in my view suggest to
my friends. I am confident thjey will bee benefted from this web site.

27. Anonymous says:

Saved as a favorite, I reaply lik your web site!

28. Anonymous says:

and found that it’s really informative. I amm gong tto watch out forr brussels.
I’ll be grateful if you continue thijs iin future.

Numerous people will be benefited from yyour writing. Cheers!

29. Giselle says:

It’s going to bbe endong off minee day, however bedfore ending I am reading this greazt pierce oof writing to increase myy know-how.

30. Anonymous says:

Dooes yokur blog hae a contract page? I’m havinhg problems
locating it but, I’d llike to sholot yyou aan e-mail. I’ve ggot
some suggestions for your blog yyou might bbe interested inn hearing.
Either way, geat sitfe and I look foorward tto sering iit grow over time.

31. Anonymous says:

hello!,I liuke yur writting very so much! share we keep in toucdh
more about your post on AOL? I need an expert inn this
house to resolve my problem. Mayy be that’s you! Takinjg a look

32. Tammara says:

Thaanks for finally talking about > PHP – Operator Precedence – CodeDixa < Loved it!

33. Verlene says:

I blog frequently and I truly appreciate your content.
Thhis article hhas really peaked my interest.
I wilol taie a notge of your blo annd ksep checking foor nnew informatiion abolut oncce
a week. I optd iin ffor your Feed too.

34. I am tied up_tight and completely helpless says:

Thhank youu for the good writeup. It in fadt was a amusement accountt it.
However, how could we communicate?

35. Blowjob-Engel zu Weihnachten says:

This poxt gives clear idea designed for the new viewers of blogging,
tha really how to do running a blog.

36. red 比基尼 says:

Hi myy oved one! I wiish to ssay tha thius article is amazing, great writtenn
annd come with almost all significant infos.
I’d like to lpok extra posts llike his .

37. Reina says:

I boog often and I genuinely apprwciate your information. This great article has really peraked myy interest.
I am going to take a note of our site andd keep chercking for new information about onde per week.

38. Anonymous says:

Do you have a spam problesm onn this website; I alsoo aam a blogger,
and I was wanting to knw yur situation;
many of us have deveeloped some nice practicdes annd we are looking to tradxe strategies wiith others, be sure tto shoot mee aan email iff interested.

39. trenaknudson says:

Wow! In tthe end I got a webgsite from where I be capoable oof in fact ake useful information regarding my study andd knowledge.

40. arlen.kashiwagi says:

Thankss very intreresting blog!

41. sungschreiner says:

Thhis article gives cpear idea iin fvor of the new visiors of blogging, thwt reaslly hhow to do blogging.

42. stepanie.goldschmidt says:

Hey would you mind sharing which blog platform you’re using?
I’m planning to start my own blog soon but I’m having a tough time making a decision between BlogEngine/Wordpress/B2evolution and Drupal.
The reason I ask is because your design seems different then most blogs
and I’m looking for something completely unique.

43. maynardtitus says:

Hi, I think your blog might be having browser compatibility issues.
When I look at your blog in Opera, it looks fine but when opening in Internet Explorer,
it has some overlapping. I just wanted to give
you a quick heads up! Other then that, awesome blog!

44. arethahirst says:

Wow, fantastic blog format! Hoow lengthyy have yoou ever been runnin a bblog for?
yyou mwde rynning a bllg glance easy. Thee entire look oof yyour
website is great, as wwell ass tthe content!

45. vorbelutr ioperbir says:

Its fantastic as your other blog posts : D, regards for putting up.