fork download
  1. <?php
  2. generate(80,10);
  3. function generate($start, $level){
  4. $i=1; // Just a var
  5. $array = array_fill(0, $level, $start); // create an array with $level elements, with value $start
  6. array_map(function($v)use(&$i){ // Loop through the array and use $i
  7. echo "Level $i: ".(array_product(array($v, pow(1.5, $i++))))."<br>\r\n"; // Some basic math and output
  8. }, $array);
  9. }
  10. ?>
Success #stdin #stdout 0.01s 20520KB
stdin
Standard input is empty
stdout
Level 1: 120<br>
Level 2: 180<br>
Level 3: 270<br>
Level 4: 405<br>
Level 5: 607.5<br>
Level 6: 911.25<br>
Level 7: 1366.875<br>
Level 8: 2050.3125<br>
Level 9: 3075.46875<br>
Level 10: 4613.203125<br>