note 86835 added to function.sprintf

From: Date: Wed, 05 Nov 2008 21:40:22 +0000
Subject: note 86835 added to function.sprintf
Groups: php.notes 
Request: Send a blank email to php-notes+get-146186@lists.php.net to get a copy of this message
<? // parses a string meant for printf and returns an array of found parameters (or NULL if it contains syntax errors) function parsePrintfParameters($string) { $valid = '/^(?:%%|%(?:[0-9]+\$)?[+-]?(?:[ 0]|\'.)?-?[0-9]*(?:\.[0-9]+)?[bcdeufFosxX])/'; $originalString = $string; $result = array(); while(strlen($string)) { if(!$string = preg_replace('/^[^%]*/', '', $string)) break; if(preg_match($valid, $string, $matches)) { $result[] = $matches[0]; $string = substr($string, strlen($matches[0])); } else { error(sprintf('"%s" has an error near "%s".', $originalString, $string)); return NULL; } } return $result; } ?> ---- Server IP: 212.124.37.9 Probable Submitter: 62.96.244.226 ---- Manual Page -- http://www.php.net/manual/en/function.sprintf.php Edit -- https://master.php.net/note/edit/86835 Del: integrated -- https://master.php.net/note/delete/86835/integrated Del: useless -- https://master.php.net/note/delete/86835/useless Del: bad code -- https://master.php.net/note/delete/86835/bad+code Del: spam -- https://master.php.net/note/delete/86835/spam Del: non-english -- https://master.php.net/note/delete/86835/non-english Del: in docs -- https://master.php.net/note/delete/86835/in+docs Del: other reasons-- https://master.php.net/note/delete/86835 Reject -- https://master.php.net/note/reject/86835 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#146186) next »