In order to understand exactly what is happening we can check the Collection class source code where we find the map function
public function map(callable $callback)
{
$keys = array_keys($this->items);
$items = array_map($callback, $this->items, $keys);
return new static(array_combine($keys, $items));
}
So what laravel does it actually adds the keys as well to the array_map function call, which ultimately produces this call array_map('intval', ['3a', '4b'], [0, 1])
This will call intval('3a', 0) and intval('4b', 1) respectively, which as expected will yield 3 and 0, because the second parameter of intval according to the official PHP docs is actually the base.
Laravel adds the keys because sometimes you might use them in your map callback as such
$collection->map(function($item, $key) { ... });