Created
February 15, 2012 20:57
-
-
Save raphaeldealmeida/1838964 to your computer and use it in GitHub Desktop.
Arrays 5.4
This file contains hidden or 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 | |
class Service\User{ | |
public function getUser(){ | |
return ['id' => 1, | |
'name' => 'Raphael Almeida', | |
'publisher' => true]; | |
} | |
} | |
//PHP 5.3 | |
$user = $service->getUser(); | |
if($user['publisher'] === true){ | |
//faz alguma coisa | |
} | |
//PHP 5.4 | |
if($service->getUser()['publisher']){ | |
//bem melhor :) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment