What's new in Laravel 8.81
What's new in Laravel 8.81
Advertisement

The Laravel team has released version 8.81, which includes:

Stringable Scan Method

Scan method is implemented using PHP’s sscanf function.

public function stringScan(){
    $serialNo = "SN/235698";
    [$id] = Str::of($serialNo)->scan('SN/%d');
    return $id;
}

Get or Put Collection Method

$collection = collect([
    'a' => 2,
    'b' => 33,
    'c' => 44
]);
//get value at the specified key
return $collection->get('a');
//put the value
return $collection->put('a',30);
//get an existing key or put the value if it doesn't exist and return the value
return $collection->getOrPut('a', '30');

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.