3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $calc = new Calc; $calc->execute(); class Calc { private $AkaraB; private $BkaraA; private $AkaraBnoZikan; private $BkaraAnoZikan; private $Abin; private $Bbin; private $ohuku; public function __construct() { fscanf(STDIN, "%d %d", $AkaraB, $BkaraA); fscanf(STDIN, "%d %d", $AkaraBnoZikan, $BkaraAnoZikan); fscanf(STDIN, "%s", $AbinString); fscanf(STDIN, "%s", $BbinString); $this->AkaraB = $AkaraB; $this->BkaraA = $BkaraA; $this->AkaraBnoZikan = $AkaraBnoZikan; $this->BkaraAnoZikan = $BkaraAnoZikan; $this->Abin = explode(' ', $AbinString); $this->Bbin = explode(' ', $BbinString); $this->ohuku = 0; } public function execute() { $now = 0; while(true) { $end = true; foreach ($this->Abin as $key => $value) { if($now <= $value){ $now = $value; $this->Abin = array_slice($this->Abin,$key+=1); $end =false; break; } } if ($end) break; $now += $this->AkaraBnoZikan; if ($now > 24) break; $nownow = $now; $end = true; foreach ($this->Bbin as $key => $value) { if($now <= $value) { $now = $value; $this->Bbin = array_slice($this->Bbin, $key+=1); $end =false; break; } } if ($end) break; $now += $this->BkaraAnoZikan; if ($now > 24) break; $this->ohuku++; } echo $this->ohuku . "\n"; } }
based on 8dsbX
Output for 7.1.0 - 7.2.0
Warning: A non-numeric value encountered in /in/uAEbC on line 46 Warning: A non-numeric value encountered in /in/uAEbC on line 59 1
Output for 5.3.19 - 7.0.20
1