note 113289 added to function.date

From: Date: Sat, 21 Sep 2013 12:36:35 +0000
Subject: note 113289 added to function.date
Groups: php.notes 
Request: Send a blank email to php-notes+get-196333@lists.php.net to get a copy of this message
This simple function replaces all date symbols with actual current date values, returns string. Using it to parse filenames, e.g. input on web. backup_db_%Y-%m-%d_%H-%i.sql --> backup_db_2013-09-21_12-27.sql function string_date_symbol_parser($string) { $chars = array_splice(explode('%', $string), 1); // Replace every 1st character with date() equivalent (row 1 already removed) foreach ($chars as $k => $v) { $string = str_replace("%".$v[0], date($v[0]), $string); } return $string; } ---- Server IP: 69.147.83.199 Probable Submitter: 62.61.128.153 ---- Manual Page -- http://php.net/manual/en/function.date.php Edit -- https://master.php.net/note/edit/113289 Del: integrated -- https://master.php.net/note/delete/113289/integrated Del: useless -- https://master.php.net/note/delete/113289/useless Del: bad code -- https://master.php.net/note/delete/113289/bad+code Del: spam -- https://master.php.net/note/delete/113289/spam Del: non-english -- https://master.php.net/note/delete/113289/non-english Del: in docs -- https://master.php.net/note/delete/113289/in+docs Del: other reasons-- https://master.php.net/note/delete/113289 Reject -- https://master.php.net/note/reject/113289 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#196333) next »