Functional Thinking Ex2

Run Settings
LanguagePHP
Language Version
Run Command
<?php /** * Example for article: http://coderoncode.com/functional-programming-the-paradigm-for-the-next-generation.html */ $sumList = [5,'four','two',10,'one',28,6,'five']; $sum = 0; $numDict = [ 1 => 'one', 2 => 'two', 3 => 'three', 4 => 'four', 5 => 'five']; foreach($sumList as $value) { $arr = array_flip($numDict); if(is_string($value)) { $value = $arr[$value]; } $sum += $value; } echo $sum;
Editor Settings
Theme
Key bindings
Full width
Lines