3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function convertToSeconds($time) { if (!preg_match('/(\d{1,2}):(\d{2})/', $time)) { return 0; } return preg_replace_callback('/(\d{1,2}):(\d{2})/', function($e) { return $e[1] * 60 + $e[2]; }, $time); } echo convertToSeconds('02:22');
based on DfiZG
Output for 5.6.0 - 7.3.0beta1
142