Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

--TEST-- MessageFormatter::format(): DateTime accepted to format dates and times --INI-- d..

Decoded Output download

--TEST--
MessageFormatter::format(): DateTime accepted to format dates and times
--INI--
date.timezone=Atlantic/Azores
--EXTENSIONS--
intl
--SKIPIF--
<?php if (version_compare(INTL_ICU_VERSION, '72.1') >= 0) die('skip for ICU < 72.1'); ?>
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
//ini_set("intl.default_locale", "nl");

$fmt = <<<EOD
{0,date} {0,time}
EOD;

$dt = new DateTime("2012-05-06 18:00:42", new DateTimeZone("Europe/Lisbon"));
$dti = new DateTimeImmutable("2012-05-06 18:00:42", new DateTimeZone("Europe/Lisbon"));

$mf = new MessageFormatter('en_US', $fmt);

var_dump($mf->format(array($dt)));
var_dump($mf->format(array($dti)));

?>
--EXPECTF--
string(%s) "May %d, 2012 %d:%d:42 %s"
string(%s) "May %d, 2012 %d:%d:42 %s"

Did this file decode correctly?

Original Code

--TEST--
MessageFormatter::format(): DateTime accepted to format dates and times
--INI--
date.timezone=Atlantic/Azores
--EXTENSIONS--
intl
--SKIPIF--
<?php if (version_compare(INTL_ICU_VERSION, '72.1') >= 0) die('skip for ICU < 72.1'); ?>
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
//ini_set("intl.default_locale", "nl");

$fmt = <<<EOD
{0,date} {0,time}
EOD;

$dt = new DateTime("2012-05-06 18:00:42", new DateTimeZone("Europe/Lisbon"));
$dti = new DateTimeImmutable("2012-05-06 18:00:42", new DateTimeZone("Europe/Lisbon"));

$mf = new MessageFormatter('en_US', $fmt);

var_dump($mf->format(array($dt)));
var_dump($mf->format(array($dti)));

?>
--EXPECTF--
string(%s) "May %d, 2012 %d:%d:42 %s"
string(%s) "May %d, 2012 %d:%d:42 %s"

Function Calls

None

Variables

None

Stats

MD5 eba3c6280c7aedba57b61dc0785110af
Eval Count 0
Decode Time 98 ms