3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $fmtEN = new MessageFormatter("en_US", "{GENDER, select, male {He} female {She} other {} } added {NUM_ITEMS, plural, one {1 kitten} other {# kittens} } to the cart."); $fmtPL = new MessageFormatter("pl_PL", "{GENDER, select, male {On dodal} female {Ona dodala} other {} } {NUM_ITEMS, plural, one {1 kotka} few {# kotki} other {# kotkow} } do koszyka."); echo $fmtEN->format(['GENDER' => 'male', 'NUM_ITEMS'=> 5]); echo PHP_EOL; echo $fmtPL->format(['GENDER' => 'male', 'NUM_ITEMS'=> 5]); echo PHP_EOL; echo $fmtEN->format(['GENDER' => 'female', 'NUM_ITEMS'=> 3]); echo PHP_EOL; echo $fmtPL->format(['GENDER' => 'female', 'NUM_ITEMS'=> 3]); echo PHP_EOL; $fmtEN = new MessageFormatter("en_US", "You added {NUM_ITEMS, plural, one {1 kitten} other {# kittens} } to the cart."); $fmtPL = new MessageFormatter("pl_PL", "{GENDER, select, male {Dodales} female {Dodalas} other {} } {NUM_ITEMS, plural, one {1 kotka} few {# kotki} other {# kotkow} } do koszyka."); echo $fmtEN->format(['GENDER' => 'male', 'NUM_ITEMS'=> 5]); echo PHP_EOL; echo $fmtPL->format(['GENDER' => 'male', 'NUM_ITEMS'=> 5]); echo PHP_EOL; echo $fmtEN->format(['GENDER' => 'female', 'NUM_ITEMS'=> 3]); echo PHP_EOL; echo $fmtPL->format(['GENDER' => 'female', 'NUM_ITEMS'=> 3]); echo PHP_EOL;
Output for 5.5.24 - 5.5.28, 5.5.31 - 5.5.33, 5.5.35 - 5.6.12, 5.6.16 - 5.6.19, 5.6.21 - 7.0.4, 7.0.6 - 7.2.0
He added 5 kittens to the cart. On dodal 5 kotkow do koszyka. She added 3 kittens to the cart. Ona dodala 3 kotki do koszyka. You added 5 kittens to the cart. Dodales 5 kotkow do koszyka. You added 3 kittens to the cart. Dodalas 3 kotki do koszyka.
Output for 7.0.5
Fatal error: Uncaught Error: Class 'MessageFormatter' not found in /in/nqTId:3 Stack trace: #0 {main} thrown in /in/nqTId on line 3
Process exited with code 255.
Output for 5.5.29 - 5.5.30, 5.5.34, 5.6.13 - 5.6.15, 5.6.20
Fatal error: Class 'MessageFormatter' not found in /in/nqTId on line 3
Process exited with code 255.
Output for 5.4.1 - 5.4.45
{GENDER} added {NUM_ITEMS} to the cart. {GENDER} {NUM_ITEMS} do koszyka. {GENDER} added {NUM_ITEMS} to the cart. {GENDER} {NUM_ITEMS} do koszyka. You added {NUM_ITEMS} to the cart. {GENDER} {NUM_ITEMS} do koszyka. You added {NUM_ITEMS} to the cart. {GENDER} {NUM_ITEMS} do koszyka.
Output for 5.3.18 - 5.3.29
Parse error: syntax error, unexpected '[', expecting ')' in /in/nqTId on line 21
Process exited with code 255.