Easy PHP Solution
\nclass Solution {\n    /**\n     * @param Integer $initialEnergy\n     * @param Integer $initialExperience\n     * @param Integer[] $energy\n     * @param Inte
```\nclass Solution {\n    /**\n     * @param Integer $initialEnergy\n     * @param Integer $initialExperience\n     * @param Integer[] $energy\n     * @param Integer[] $experience\n     * @return Integer\n     */\n    function minNumberOfHours($initialEnergy, $initialExperience, $energy, $experience) {\n        $hours = array_sum($energy) - $initialEnergy + 1;\n        $hours = $hours > 0 ? $hours : 0;\n\n        foreach ($experience as $exp) {\n            if (($train = $exp - $initialExperience) >= 0) {\n                $hours += $train + 1;\n                $initialExperience += $train + 1;\n            }\n            $initialExperience += $exp;\n        }\n        return $hours;\n    }\n}\n```
['PHP']