Skip to content

Instantly share code, notes, and snippets.

@raphaeldealmeida
Created February 15, 2012 20:57
Show Gist options
  • Save raphaeldealmeida/1838964 to your computer and use it in GitHub Desktop.
Save raphaeldealmeida/1838964 to your computer and use it in GitHub Desktop.
Arrays 5.4
<?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