All Go Rust Python PHP JavaScript
Chrome Dev Summit to secure your spot in workshops, office hours and learning lounges!

How to Delete an Element from an Array in PHP

In PHP, there are 3 ways to delete an element from an array. Using unset Function The unset(mixed $var, mixed ...$vars): void function destroys the specified variables. For example, $arr = ["a", "b", "d"]; unset($arr[1]); print_r($arr); Arr...
Sambhav Khandelwal

How to reverse an array in PHP

Reverse the order of an array.Using array_reverse Function The array_reverse() return an array with elements in reverse order. $arr = array("PHP", 8.1, 4); $reversed = array_reverse($arr); print_r($reversed); $preserved = array_reverse($arr, true);...
aweis

How to print an object in PHP

Printing all properties of an object. Using print_r Function The print_r() prints human-readable information about a variable. If given a string, int or float, the value itself will be printed. If given an array, values will be presented in a format...
Sambhav Khandelwal