Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php ternary string

$if = function($test, $true, $false)
{
  return $test ? $true : $false;
};

echo "class='{$if(true, 'abc', 'def')}'";
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #php #ternary #string
ADD COMMENT
Topic
Name
3+5 =