数据类型bollean interger float string array object resource NULL callback/callable
输出 echo print print_r var_dump
echo输出*arr不输出object语法错误
print同echo
print_r同print不过array输出键和值object不报错
var_dump同print_r不过还有输出数据类型常为开发用
<?php class objecttt{ function foo(){ echo "this a object"; } } $booleann=true; $intt=123; $floatt=12.3; $stringg="sstrr"; $arrayy=array("first","two","secend"); $objectt=new objecttt; $objectt->foo(); echo $booleann."boolean "; echo $intt."int "; echo $floatt."float "; echo $stringg."string "; echo $arrayy."array <br>"; //echo $objectt."object <br>"; print $booleann."boolean "; print $intt."int "; print $floatt."float "; print $stringg."string "; print $arrayy."array <br>"; //print $objectt."object <br>"; //print_r $booleann."boolean "; //print_r $intt."int "; print_r($floatt); print_r($stringg); print_r($arrayy); print_r($objectt); echo "<br>"; var_dump($floatt); var_dump($stringg); var_dump($arrayy); var_dump($objectt); echo "<br>" ?>
php值类型不需要定义为自动转换
https://www.php.net/manual/zh/language.types.type-juggling.php
php类型比较
== 松散比较只比较值不比较类型
===严格比较比较值也比较类型要全一样
参考https://www.runoob.com/php/php-types-comparisons.html
梦