lowest positive value - PHP Online

Form of PHP Sandbox

Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php in the places where the PHP script should be executed.



Your result can be seen below.

Result of php executing





Full code of lowest positive value.php

  1. <?php
  2. $a = 0;
  3. $b = 4;
  4. $c = 8;
  5.  
  6. $s = \array_reduce(
  7.             \array_filter(
  8.                 [ $a, $b, $c ],
  9.                 static function ($quantity) {
  10.                     return $quantity > 0;
  11.                 }
  12.             ),
  13.             static function ($lowest, $quantity) {
  14.                 return $lowest === null || $quantity < $lowest $quantity : $lowest;
  15.             }
  16.         );
  17.  
  18. var_dump($s);
File Description
  • lowest positive value
  • PHP Code
  • 18 Nov-2019
  • 407 Bytes
You can Share it: