1--TEST-- 2Test array_column(): Index argument with various types in strict type mode 3--FILE-- 4<?php 5declare(strict_types=1); 6 7echo "\n-- Testing array_column() column key parameter should be a string or an integer (testing bool) --\n"; 8try { 9 var_dump(array_column([['php7', 'foo'], ['php8', 'bar']], false)); 10} catch (\TypeError $e) { 11 echo $e->getMessage() . "\n"; 12} 13try { 14 var_dump(array_column([['php7', 'foo'], ['php8', 'bar']], true)); 15} catch (\TypeError $e) { 16 echo $e->getMessage() . "\n"; 17} 18 19echo "\n-- Testing array_column() column key parameter should be a string or integer (testing array) --\n"; 20try { 21 var_dump(array_column([['php7', 'foo'], ['php8', 'bar']], array())); 22} catch (\TypeError $e) { 23 echo $e->getMessage() . "\n"; 24} 25 26echo "\n-- Testing array_column() index key parameter should be a string or an integer (testing bool) --\n"; 27try { 28 var_dump(array_column([['php' => 7, 'foo'], ['php' => 8, 'bar']], 'php', false)); 29} catch (\TypeError $e) { 30 echo $e->getMessage() . "\n"; 31} 32try { 33 var_dump(array_column([['php' => 7, 'foo'], ['php' => 8, 'bar']], 'php', true)); 34} catch (\TypeError $e) { 35 echo $e->getMessage() . "\n"; 36} 37 38echo "\n-- Testing array_column() index key parameter should be a string or integer (testing array) --\n"; 39try { 40 var_dump(array_column([['php' => 7, 'foo'], ['php' => 8, 'bar']], 'php', array())); 41} catch (\TypeError $e) { 42 echo $e->getMessage() . "\n"; 43} 44 45?> 46 47DONE 48--EXPECT-- 49-- Testing array_column() column key parameter should be a string or an integer (testing bool) -- 50array_column(): Argument #2 ($column_key) must be of type string|int|null, false given 51array_column(): Argument #2 ($column_key) must be of type string|int|null, true given 52 53-- Testing array_column() column key parameter should be a string or integer (testing array) -- 54array_column(): Argument #2 ($column_key) must be of type string|int|null, array given 55 56-- Testing array_column() index key parameter should be a string or an integer (testing bool) -- 57array_column(): Argument #3 ($index_key) must be of type string|int|null, false given 58array_column(): Argument #3 ($index_key) must be of type string|int|null, true given 59 60-- Testing array_column() index key parameter should be a string or integer (testing array) -- 61array_column(): Argument #3 ($index_key) must be of type string|int|null, array given 62 63DONE 64