Can someone explain what this line does? (PHP)?

  • Thread starter Thread starter hfd1989
  • Start date Start date
H

hfd1989

Guest
$first = ord($plaintext[$i]) >= ord('a') ? ord('a') : ord('A');

I'm trying to get to grips with a PHP code snippet, however that line is confusing me - can anyone break down what it's doing? Thanks
 
This is what is called a Ternary Operator it is just like an if else statement:.....

if ord($plaintext[$i]) >= ord('a') is true then $first = ord('a') else $first = ord('A');
 
Back
Top