Handling of 'or' condidions in Ruby vs PHP
Posted
by Adam
on Stack Overflow
See other posts from Stack Overflow
or by Adam
Published on 2010-05-30T19:52:46Z
Indexed on
2010/05/30
20:12 UTC
Read the original article
Hit count: 192
I'm not sure what to call this, so I'll give an example.
In PHP
1==2 || 2
returns 1
or true
In Ruby
1==2 || 2
returns 2
(The second statement if the first evaluates to false).
Is there any short way to implement similar thing in PHP?
© Stack Overflow or respective owner