|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Explain this plez
Hey everyone,
Can someone explain this code to me plez. echo (sizeof($results)==1?" article":" articles"); I don't get what the ? and : is for. Thanks
__________________
Nothing is Everything
|
|
#2
|
||||
|
||||
|
Its short hand way of writing IF statements... The official term has slipped me right now... but basically it could also be written like this:
PHP Code:
|
|
#3
|
||||
|
||||
|
It's a ternary operator. To elaborate a smidgin, the ? means "look at the preceding expression; if it evaluates to true, return the value immediately following me; else return the value after the colon."
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > Explain this plez |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|