by @saigowthamr

How to echo a boolean(true, false) in Php

Home » php » How to echo a boolean(true, false) in Php

To echo a boolean value we can use the ternary operator ? in Php.

Here is the example:

$name='king';

$bool = $name ? "true":"false";

echo $bool;

Output:

true

Best Web Development courses