boolean - PHP - Get bool to echo false when false -


for reason, following code doesn't print out anything:

$bool_val = (bool)false; echo $bool_val; 

but following code prints out 1:

$bool_val = (bool)true; echo $bool_val; 

is there better way print out 0 or false when $bool_val false adding if statement?

edit: changed second statement false true

echo $bool_val ? 'true' : 'false'; 

or if want output when it's false:

echo !$bool_val ? 'false' : ''; 

Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -