Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php ternary operator

(conditional) ? (execute this when true) : (execute this when false);
# example
<?php
  $age = 20;
  print ($age >= 18) ? "Adult" : "Not Adult";
?>
# output
  Adult
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #php #ternary #operator
ADD COMMENT
Topic
Name
1+6 =