3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Documented in the interface. function formatDuration($locale, $duration) { $rule = " %with-words: 0: 0 secondes; 1: 1 seconde; 2: =#0= secondes; 60/60: <%%min<; 61/60: <%%min<, >%with-words>; 3600/60: <%%hr<; 3601/60: <%%hr<, >%with-words>; 86400/86400: <%%day<; 86401/86400: <%%day<, >%with-words>; 604800/604800: <%%week<; 604801/604800: <%%week<, >%with-words>; %%min: 1: 1 minute; 2: =#0= minutes; %%hr: 1: 1 heure; 2: =#0= heures; %%day: 1: 1 jour; 2: =#0= jours; %%week: 1: 1 semaine; 2: =#0= semaines; "; $fmt = new NumberFormatter($locale, NumberFormatter::PATTERN_RULEBASED, $rule); return $fmt->format($duration); } var_dump( formatDuration('en_US', 12345) ); var_dump( formatDuration('fr_CA', 12345) );
Output for git.master, git.master_jit, rfc.property-hooks
string(33) "3 heures, 25 minutes, 45 secondes" string(33) "3 heures, 25 minutes, 45 secondes"

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
45.77 ms | 401 KiB | 8 Q