3
19/10/2024 9:45 上午
主题启动器
Can you please share the advanced functionality in PHP of the arrays and the associative arrays and their functions and sorting functions?
Please give some examples with code.
谢谢
1 答案
2
19/10/2024 9:47 上午
Some commonly used:
Examples:
array_push($arr, variable) - push (add) one or more elements into the end of array:
$arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; array_push($arr, 11, 12, 13, 100); echo implode(", ", $arr); // $arr = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 100
array_pop($arr) - Pop (remove) the element of the end of the array:
$arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; array_pop($arr); echo implode(", ", $arr); // $arr = 1, 2, 3, 4, 5, 6, 7, 8, 9