« PHP 8.3 Manual トップ
著作権 »
per page, with , order by , clip by
Results of 1 - 2 of about 2 for sour (0.001 sec.)
配列の全ての要素に、ユーザー関数を再帰的に適用する 9357
« array_walk arsort » PHP Manual 配列 関数 配列の全ての要素に、ユーザー関数を再帰的に適用する 検索 array_walk_recursive (PHP 5, PHP 7, PHP 8) array_walk_recursive — 配列の全ての要素に、ユーザー関数を再帰的に適用する 説明 function array_walk ... rray_walk_recursive() の例 <?php $sweet = array( 'a' => 'apple' , 'b' => 'banana' ); $fruits = array( 'sweet' => $sweet , 'sour' => 'lemon' ); function test_print ( $item , $key ) { echo " $key holds $item \n" ; } array_walk_recursive ( $fruits , 'te ... st_print' ); ?> 上の例の出力は以下となります。 a holds apple b holds banana sour holds lemon キー ' sweet ' が表示されないことにお気づきでしょう。 array を要素として持つキーは関数に渡されません。 コールバ ... もできます。 例2 値をその場で更新する <?php $sweet = [ 'a' => 'apple' , 'b' => 'banana' ]; $fruits = [ 'sweet' => $sweet , 'sour' => 'lemon' ]; function test_update (& $item ) { $item = strtoupper ( $item ); } function test_print ( $item , $key ) { ec ...
https://man.mtool.work/php/8.3/function.array-walk-recursive.html
配列の全ての要素に、ユーザー関数を再帰的に適用する 9357
« array_walk arsort » PHP Manual 配列 関数 配列の全ての要素に、ユーザー関数を再帰的に適用する 検索 array_walk_recursive (PHP 5, PHP 7, PHP 8) array_walk_recursive — 配列の全ての要素に、ユーザー関数を再帰的に適用する 説明 function array_walk ... rray_walk_recursive() の例 <?php $sweet = array( 'a' => 'apple' , 'b' => 'banana' ); $fruits = array( 'sweet' => $sweet , 'sour' => 'lemon' ); function test_print ( $item , $key ) { echo " $key holds $item \n" ; } array_walk_recursive ( $fruits , 'te ... st_print' ); ?> 上の例の出力は以下となります。 a holds apple b holds banana sour holds lemon キー ' sweet ' が表示されないことにお気づきでしょう。 array を要素として持つキーは関数に渡されません。 コールバ ... もできます。 例2 値をその場で更新する <?php $sweet = [ 'a' => 'apple' , 'b' => 'banana' ]; $fruits = [ 'sweet' => $sweet , 'sour' => 'lemon' ]; function test_update (& $item ) { $item = strtoupper ( $item ); } function test_print ( $item , $key ) { ec ...
https://man.mtool.work/php/8.3/function.array-walk-recursive.html
PREV 1 NEXT