Sometimes when using the php artisan tinker
console I do something like the following:
$int->groupBy('tracking_code')->toArray();
instead of:
$a = $int->groupBy('tracking_code')->toArray();
If the operation is very complex and/or is on lots of records, it can be a pain to repeat with the variable assignment. So my question is whether the result of the last command is stored anywhere so I can manipulate it without having to wait for the operation to complete a second time?
Tinker uses PsySH as the REPL.
$a = $_
$_
is a magic variable that holds the result of the last successful execution.
You can find documentation for PsySH on its website: