Jump to content

syntax question


deepman007

Recommended Posts

This is called the ternary operator, it is the short way of writing an if/else statement.

 

This:

$sku_stock = (allowBackOrders) ? "" : " AND S.SKU_Stock > 0";

 

Is the short version of writing:

<?php

if (allowBackOrders){
   $sku_stock = "";
} else {
   $sku_stock = " AND S.SKU_Stock > 0";
}

?>

Link to comment
https://forums.phpfreaks.com/topic/97022-syntax-question/#findComment-496486
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.