LoginSignup
0
1

More than 3 years have passed since last update.

【php】組み込み関数

Last updated at Posted at 2019-08-19

組み込み関数: strlen

phpには便利な関数がもとから組み込まれており、それを組み込み関数と呼ぶ。組み込み関数「strlen」は文字列の文字数を返す。

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

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

組み込み関数: count / rand

「count」は配列の要素の数を返す。
「rand」は1つ目の引数と2つ目の引数の間のランダムな整数を返す。

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

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

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1