- implode: documentation ( source)
<?php
/**
* @param array{id: string, name: string} $user
* @return array{id: string, name: string}
*/
function takesUserData(array $user): array {
$user['extra_data'] = new stdClass();
return $user;
}
$foo = ['id' => 'DP42', 'name' => 'Douglas Adams'];
echo implode('', takesUserData($foo));