Skip to content

Instantly share code, notes, and snippets.

@matyax
Created December 10, 2014 14:56
Show Gist options
  • Save matyax/ab67ff394f50ad9819d2 to your computer and use it in GitHub Desktop.
Save matyax/ab67ff394f50ad9819d2 to your computer and use it in GitHub Desktop.
<?php
// Una alternativa
$flavors1 = [ 'chocolate', 'strawberry', 'vanilla',
'chocolate chip', 'mint chocolate chip', 'rocky road',
'cookie dough', 'peach', 'fudge brownie',
'coffee', 'mocha chip' ];
class PeopleController extends AppController {
public function index() {
if (! $this->request->is('post')) {
//descartar condiciones en vez de anidarlas
//sorry, me sale el Nazi
return;
}
//otra alternativa
if ($condition1 == true) {
$flavors1 = [
'chocolate',
'strawberry',
'vanilla',
'cookie dough',
'chocolate chip',
'mint chocolate chip',
'rocky road',
'peach',
'fudge brownie',
'coffee',
'mocha chip'
];
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment