I've created a function but I don't manage to set the boolean value in it.
$msg = '';
$error = false;
function error($content)
{
if (empty($msg)){
$msg = $content;
}
$error = true;
return $msg;
}
So if I test
<p>test: <?=error('some content');?></p>
<p>error: <?=$error?></p>
<?php
if ($error){
$temp = 'YES';
}else{
$temp = 'NO';
}
?>
<p>temp: <?=$temp?></p>
it will return
test: some content
error: 1
temp: NO
I really don't understand, can someone help me ?