Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Reverse a string
<?php strrev(string $string): string
<?php     {

        $data = ['first' => 'taylor', 'last' => 'otwell'];

        $mapped = Arr::map($data, function ($value, $key) {

            return $key.'-'.strrev($value);

        });

        $this->assertEquals(['first' => 'first-rolyat', 'last' => 'last-llewto'], $mapped);

        $this->assertEquals(['first' => 'taylor', 'last' => 'otwell'], $data);
<?php         $data = new $collection(['first' => 'taylor', 'last' => 'otwell']);

        $data = $data->map(function ($item, $key) {

            return $key.'-'.strrev($item);

        });

        $this->assertEquals(['first' => 'first-rolyat', 'last' => 'last-llewto'], $data->all());

    }
<?php     {

        $data = new Collection(['first' => 'taylor', 'last' => 'otwell']);

        $data->transform(function ($item, $key) {

            return $key.'-'.strrev($item);

        });

        $this->assertEquals(['first' => 'first-rolyat', 'last' => 'last-llewto'], $data->all());

    }