April 22, 2018 —John Koster
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
∎
The following amazing people help support this site and my open source projects ♥️
If you're interesting in supporting my work and want to show up on this list, check out my GitHub Sponsors Profile.