3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $formatter = \NumberFormatter::create(\Locale::getDefault(), \NumberFormatter::DECIMAL); var_dump($formatter->getTextAttribute(\NumberFormatter::POSITIVE_PREFIX)); var_dump($formatter->getTextAttribute(\NumberFormatter::NEGATIVE_PREFIX)); $formatter->setTextAttribute(\NumberFormatter::POSITIVE_PREFIX, $formatter->getSymbol(\NumberFormatter::PLUS_SIGN_SYMBOL)); var_dump($formatter->format(12)); var_dump($formatter->format(-12)); var_dump($formatter->format(12.5)); var_dump($formatter->format(0)); var_dump($formatter->format(-0));
based on PL1gb
Output for 5.5.0 - 7.3.1
string(0) "" string(1) "-" string(3) "+12" string(3) "-12" string(5) "+12.5" string(2) "+0" string(2) "+0"