Last active
September 26, 2018 20:47
-
-
Save iget-esoares/3b4786ed5d44e9c59ea76bc4fd0e9678 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function splitMyName(string $name) { | |
return explode(' ', $name); | |
} | |
function extractNameFromData(array $data) { | |
return splitMyName($data['role']); | |
} | |
$data = [ | |
'id' => 110690, | |
'name' => 'Elias Soares', | |
'role' => null | |
]; | |
$name = extractNameFromData($data); | |
echo $name[0]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment