Skip to content

Instantly share code, notes, and snippets.

View DASPRiD's full-sized avatar

Ben Scholzen DASPRiD

View GitHub Profile
@DASPRiD
DASPRiD / text.php
Last active August 29, 2015 13:59 — forked from bakura10/text.php
<?php
$routes = [];
if ($_SERVER['ENV'] === 'production') {
$options = ['hostname' => 'connect.mysite.com', 'secure' => true];
} else {
$options = ['hostname' => 'connect.localhost.com'];
}
------------------------------------------------------------------------------
To be added (Zend\I18n namespace):
View helpers:
- DateFormat <DASPRiD>
- NumberFormat <cgmartin>
- Currency <cgmartin>
------------------------------------------------------------------------------
Convert to work with DateTime, Intl extension and/or Zend\I18n\Translator:
@DASPRiD
DASPRiD / gist:3005056
Created June 27, 2012 16:03 — forked from cgmartin/gist:3004926
Float and NumberFormatter oddity
$locale = $this->locale;
$fmt = new NumberFormatter($locale, NumberFormatter::DECIMAL);
if (intl_is_failure($fmt->getErrorCode())) {
throw new Exception\InvalidArgumentException("Invalid locale string given");
}
$parsedFloat = $fmt->parse($value, NumberFormatter::TYPE_DOUBLE, $position);
if (intl_is_failure($fmt->getErrorCode()) || $position < strlen($value)) {
$this->error(self::NOT_FLOAT);
return false;