Let's get started quickly and take some examples of these great methods
There’s now a helper method called reverse() in Illuminate\Support\Str and Illuminate\Support\Stringable using which it’s now convenient to reverse strings.
use Illuminate\Support\Str;
echo Str::reverse('raBooF');
// FooBar
echo Str::of('FooBar')->reverse();
// raBooF
And next, the framework has got the counterpart of the Arr::dot() method called undot().
use Illuminate\Support\Arr;
$productInfo = [
'products.desk.price' => 100
];
$unflattenedProductInfo = Arr::undot($productInfo);
/*
[
'products' => [
'desk' => [
'price' => 100
]
]
];
*/
I hope you enjoyed the code.
Top comments (0)