Published on April 22, 2018
The dump
method is similar to the dd
method in that it is used to dump the contents of the collection to the output for debugging purposes, however, unlike the dd
method, the dump
method will not stop execution of the script. Because of the behavior of the dump
method, its behavior is very similar to PHP's var_dump
function.
1public function dump(2 ...$args3);
The following example demonstrates the behavior of the dump
method:
1$collection = collect([2 'key' => 'value'3]);4 5$collection->dump();6 7echo 'This will be visible in the output';
The above example would produce output similar to the following:
1Collection {2 #items: array:1 [3 "key" => "value"4 ]5}6This will be visible in the output
∎
John Koster
Learning text parsing, manipulation, encoding and more through the Laravel string helpers.
Published on November 27, 2017
Published on April 22, 2018
Published on November 16, 2016