Most of the time we make our decisions in php with an if statement or a switch statement, sometimes this can be enhanced in an expressive way by using arrays.
$language = 'php';
switch ($language) {
case 'php':
$creator = 'Rasmus Lerdorf';
break;
case 'javascript':
$creator = 'Brendan Eich';
break;
case 'vue':
$creator = 'Evan You';
break;
case 'livewire':
$creator = 'Caleb Porzio';
break;
case 'laravel':
$creator = 'Taylor Otwell';
break;
}
$language = 'php';
$creators = [
'php' => 'Rasmus Lerdorf',
'javascript' => 'Brendan Eich',
'vue' => 'Evan You',
'livewire' => 'Caleb Porzio',
'laravel' => 'Taylor Otwell'
];
$creator = $creators[$language];
LLoadout is your loadout for Laravel, helping you kickstart your development process. Besides this refactoring site we also make some cool packages and video tutorials !
Go to LLoadout on github