Category: PHP

PHP usort() Function

The usort() function is used to sort an array by its values using a user-defined comparison function. If the array you wish to sort needs to be sorted by some non-trivial criteria, you should use this function. TRUE on success. FALSE on failure Parameter Description array Required. Specifies the array to sort myfunction Optional. A […]

PHP array_multisort() Function

The array_multisort() function returns a sorted array. You can assign one or more arrays. The function sorts the first array, and the other arrays follow, then, if two or more values are the same, it sorts the next array, and so on. Note: Associative (string) keys will be maintained, but numeric keys will be re-indexed. […]

Ternary operator in Laravel 5

Just today, I was looking at using a ternary operator in Laravel’s Blade templating system. However, instead of writing a ternary statement, Blade provides you with the following convenient short-cut: In this example, if the $string variable exists, its value will be displayed. However, if it does not exist, the word something will be displayed.