Signature Use | Laravel 5: Reducing a Multi-Dimensional Array to a Single Dimension Losing Keys With flatten
The signature of the flatten method is: 1 public static function flatten ( 2 $ array , 3 $ depth = INF 4 ) ;
Showing 10 of 1,280 results.
The signature of the flatten method is: 1 public static function flatten ( 2 $ array , 3 $ depth = INF 4 ) ;
Consider the following array: 1 $ arrayToFlatten = [ 2 ' keys ' => ' first value ' , 3 ' will ' => ' second value ' , 4 ' be ' => ' third value ' , 5 ' removed ' => ' fourth value ' 6 ] ; If we flatten the array like so: 1 <?php 2 3 $ newArray =...
The array_flatten function is a shortcut to calling Arr::flatten . This function is declared in the global namespace.
The signature of the camel method is: 1 public static function camel ( 2 $ value 3 ) ;
The following examples will all return the string myWords : 1 use Illuminate \ Support \ Str ; 2 3 // myWords 4 echo Str :: camel ( ' my words ' ) ; 5 6 // myWords 7 echo Str :: camel ( ' my-words ' ) ; 8 9 // myWords 10 echo Str :: camel ( '...
The camel_case function is a shortcut to calling Str::camel . This function is declared in the global namespace.
1 public function sortByDesc ( 2 $ callback , 3 $ options = SORT_REGULAR 4 ) ;
The following calls to the sortBy and sortByDesc methods are functionally equivalent: 1 use Illuminate \ Support \ Collection ; 2 3 // Create a new collection instance. 4 $ collection = new Collection ( [ 5 [ ' name ' => ' Marshall ' ] 6 ] ) ; 7 8...
Like the sortBy method, the sortByDesc method can also be used with higher order messages. We will adjust the example explored in the sortBy section: The PeripheralDevice Class: 1 class PeripheralDevice 2 { 3 public $ name = ' ' ; 4 5 public...
The CSRF token is stored in the session and is a random string 40 characters in length. It is generated using the str_random(40) function call.