Browsing Category
PHP
Sort An Associative Array in Descending Order by Value in PHP
In this tutorial we will explains how to sort an associative array in descending order by value in PHP. You can use the arsort() function for sorting an associative array in descending order by value, while maintaining the relationship…
Sort An Associative Array in Ascending Order by Value in PHP
In this tutorial we will explains how to sort an associative array in ascending order by value in PHP. You can use the asort() function for sorting an associative array in ascending order by value, while maintaining the relationship between…
Sort An Associative Array in Descending Order by key in PHP
In this tutorial we will explains how to sort an associative array in descending order by key in PHP. You can use the krsort() function for sorting an associative array in descending order by key, while maintaining the relationship between…
Sort An Associative Array in Ascending Order by key in PHP
In this tutorial we will explains how to sort an associative array in ascending order by key in PHP. You can use the ksort() function for sorting an associative array in ascending order by key, while maintaining the relationship between key…
How to Calculate the sum of values in an Array in PHP
You can use the PHP array_sum() function calculate the sum of values in an array. The array_sum() function returns the sum of all the numeric values in an array.
Read Also: How to Remove Last Element From An Array In PHP
PHP…
How to Remove the First element from an array in PHP
You can use the PHP array_shift() function remove the first element from an array in PHP. The array_shift() function returns the first value of the array. If array is empty or is not an array then NULL will be returned.
Read Also: How to…
Remove the Nth element from the end of an array
You can use the PHP array_splice() function Remove the Nth element from the end of an array. The array_splice() function remove elements from an array and replace it with new elements.The function also returns an array with the removed…
Remove Last element from an array in PHP
You can use the PHP array_pop() function remove last element from an array in PHP. The array_pop() function returns the last value of the array. If array is empty or is not an array then NULL will be returned.
Read Also: How to Remove…