$timeIsOK = preg_match('#^([01]?[0-9]|2[0-3]):[0-5][0-9]?$#', $timeString);
src: http://stackoverflow.com/questions/11005728/php-validating-24-hour-time-format
$timeIsOK = preg_match('#^([01]?[0-9]|2[0-3]):[0-5][0-9](:[0-5][0-9])?$#', $timeString);
src: http://stackoverflow.com/questions/11005728/php-validating-24-hour-time-format
$dd = $mm = $yyyy = "";
list($dd,$mm,$yyyy) = explode('/',$dateString);
$dateOK = checkdate($mm,$dd,$yyyy);
src: http://stackoverflow.com/a/3721084
//For print_r:
echo "<pre>", print_r($data, 1), "</pre>";
//For var_dump():
echo "<pre>", var_dump($data), "</pre>";
$items = array(
array('id' => 42, 'parent_id' => 1),
array('id' => 43, 'parent_id' => 42),
array('id' => 1, 'parent_id' => 0),
);
$childs = array();
foreach($items as &$item) $childs[$item['parent_id']][] = &$item;
unset($item);
foreach($items as &$item) if (isset($childs[$item['id']]))
$item['childs'] = $childs[$item['id']];
unset($item);
$tree = $childs[0];
-f == from
-t == to
iconv -f UTF-8 -t ISO-8859-15
(It only works w/ streams) ie:
cat ORIGIN | iconv -f UTF-8 -t ISO-8859-15 > DESTINATION
$x = "My string";
// Dump x
ob_start();
var_dump($x);
$contents = ob_get_contents();
ob_end_clean();
error_log($contents);
Mejor y más sencillo
$cadena = var_export($response,true);
error_log($cadena);
\Doctrine\Common\Util\Debug::dump($user);
open /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app
$transport = $this->container->get('mailer')->getTransport();
if (!$transport instanceof \Swift_Transport_SpoolTransport) {
return;
}
$spool = $transport->getSpool();
if (!$spool instanceof \Swift_MemorySpool) {
return;
}
//El quid de la cuestión!
$spool->flushQueue($this->container->get('swiftmailer.transport.real'));
(vía http://stackoverflow.com/a/13123285/1102136 )
1. delete /src/Test/BlogBundle directory
2. change /app/config/routing.yml file to remove the bundle routes
3. remove your new bundle from /app/AppKernel.php
4. clear cache (either by deleting cache/{$env} or console cache:clear)
(vía http://stackoverflow.com/questions/12142425/symfony-2-how-to-delete-a-bundle )
//$tz = new DateTimeZone('Europe/Madrid');
$age = DateTime::createFromFormat('d/m/Y', '13/12/2000')
->diff(new DateTime('now'))
->y;