Search
 
SCRIPT & CODE EXAMPLE
 

PHP

what does ? mean in PHP

/* 
in php, ? is the 'Ternary Operator'.

The expression (expr1) ? (expr2) : (expr3) evaluates 
to expr2 if expr1 evaluates to true, and expr3 if 
expr1 evaluates to false.

It is possible to leave out the middle part of the 
ternary operator. Expression expr1 ?: expr3 evaluates 
to the result of expr1 if expr1 evaluates to true, 
and expr3 otherwise. expr1 is only evaluated once in 
this case.
*/

<?php
// Example usage for: Ternary Operator
$action = (empty($_POST['action'])) ? 'default' : $_POST['action'];

// The above is identical to this if/else statement
if (empty($_POST['action'])) {
    $action = 'default';
} else {
    $action = $_POST['action'];
}
?>
Comment

what does >= mean in php

//>= Stands for greater than or equal to.
$a = 1;
$b = 0;
  if($a >= $b){
   return true; 
  }else{
   return false; 
  }
//This would return false becaue 0 is not greater than or equal to 1.
Comment

PREVIOUS NEXT
Code Example
Php :: yii framework 
Php :: assign multiple variables php 
Php :: woocommerce check if shop page 
Php :: subquery in laravel 
Php :: read file and convert each line in array php 
Php :: simple php round example 
Php :: run php with xampp 
Php :: doctrine findby criteria 
Php :: laravel http response with cookie 
Php :: error logs wp 
Php :: how to make a timer in php 
Php :: php check if passwords match 
Php :: php artisan migrate error 
Php :: php login system 
Java :: jlabel text center 
Java :: bukkit scoreboard 
Java :: for with two values java 
Java :: string to double java 
Java :: how to upgrade java 8 to 11 in ubuntu 
Java :: java int to roman 
Java :: java time code 
Java :: check java version linux 
Java :: random.choice in java 
Java :: array to map java1 
Java :: java delete directory 
Java :: JFrame labels 
Java :: como utilizar random en java 
Java :: centos install openjdk 11 
Java :: Could not find method compile() 
Java :: java double to string with 2 decimals 
ADD CONTENT
Topic
Content
Source link
Name
1+9 =