1
PHP7: Die Funktion settype()
wandelt die Boolesche Literale true
und false
bis 1.
Warum false
1 bekommen wird?settyp: Boolean zu String (wahr und falsch konvertieren zu 1)
$foo1=false;
echo "<br>foo1: ". settype ($foo1,"string"); // foo1: 1
$foo2=true;
echo "<br>foo2: ". settype ($foo2,"string"); // foo2: 1
Die Funktion strval()
wandelt false
auf einen leeren String und true
bis 1:
$foo1=false;
echo "foo1: ". strval ($foo1); // foo1:
$foo2=true;
echo "<br>foo2: ". strval ($foo2); // foo2: 1