Results of 1 - 2 of about 2 for adult (0.001 sec.)
- match 11228
- « switch declare » PHP Manual 制御構造 match 検索 match (PHP 8) match 式は、値の一致をチェックした結果に基づいて評価結果を分岐します。 switch 文と似ていますが、 match 式は複数の候補と比較される制約式を持ちます。 switch 文とは異なり、 三項演
... ge = 18 ; $output = match ( true ) { $age < 2 => "Baby" , $age < 13 => "Child" , $age <= 19 => "Teenager" , $age >= 40 => "Adult" , $age > 19 => "Young adult" , }; var_dump ( $output ); 上の例の出力は以下となります。 string(8) "Teenager" 注意 : match ... 応じてmatch式を分岐させる一般的な使い方 <?php $age = 23 ; $result = match ( true ) { $age >= 65 => 'senior' , $age >= 25 => 'adult' , $age >= 18 => 'young adult' , default => 'kid' , }; var_dump ( $result ); 上の例の出力は以下となります。 string(11) "yo ... ung adult" 例6 文字列の内容に応じてmatch式を分岐させる一般的な使い方 <?php $text = 'Bienvenue chez nous' ; $result = match ( true ) ...
-
https://man.mtool.work/php/8.3/control-structures.match.html
- match 7485
- « switch declare » PHP Manual 制御構造 match 検索 match (PHP 8) match 式は、値の一致をチェックした結果に基づいて評価結果を分岐します。 switch 文と似ていますが、 match 式は複数の候補と比較される制約式を持ちます。 switch 文とは異なり、 三項演
... ge = 18 ; $output = match ( true ) { $age < 2 => "Baby" , $age < 13 => "Child" , $age <= 19 => "Teenager" , $age >= 40 => "Adult" , $age > 19 => "Young adult" , }; var_dump ( $output ); 上の例の出力は以下となります。 string(8) "Teenager" 注意 : match ... 応じてmatch式を分岐させる一般的な使い方 <?php $age = 23 ; $result = match ( true ) { $age >= 65 => 'senior' , $age >= 25 => 'adult' , $age >= 18 => 'young adult' , default => 'kid' , }; var_dump ( $result ); 上の例の出力は以下となります。 string(11) "yo ... ung adult" 例6 文字列の内容に応じてmatch式を分岐させる一般的な使い方 <?php $text = 'Bienvenue chez nous' ; $result = match ( true ) ...
-
https://man.mtool.work/php/8.3/control-structures.match.html
PREV
1
NEXT