【PHP】内置函数

内置函数:strlen

PHP内置了许多方便的函数,被称为内置函数。内置函数”strlen”用于返回字符串的字符数。

echo strlen('string'); //文字列を返す
//結果: 6

$lang = 'japanese';
echo strlen($lang); //変数もok
//結果: 8

嵌入函数:计数/随机

「count」会返回数组的元素个数。
「rand」会返回第一个参数和第二个参数之间的随机整数。

$data = array('team1','team2','team3','team4');
echo count('$data');
//結果: 4

echo rand(10,15);
//結果: 10~15のランダムな整数を返す
bannerAds