3
19/10/2024 9:45 am
Konu başlatıcı
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.
Teşekkürler
1 Yanıt
2
19/10/2024 9:47 am
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