note 93156 added to function.sprintf
| From: | JayGilford at osu1 dot php dot net | Date: | Wed, 26 Aug 2009 00:13:38 +0000 |
| Subject: | note 93156 added to function.sprintf | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-159895@lists.php.net to get a copy of this message | ||
I created this function a while back to save on having to combine mysql_real_escape_string onto all
the params passed into a sprintf. it works literally the same as the sprintf other than that it
doesn't require you to escape your inputs. Hope its of some use to people
<?php
function mressf()
{
$args = func_get_args();
if (count($args) < 2)
return false;
$query = array_shift($args);
$args = array_map('mysql_real_escape_string', $args);
array_unshift($args, $query);
$query = call_user_func_array('sprintf', $args);
return $query;
}
?>
Regards
Jay
Jaygilford.com
----
Server IP: 87.124.86.41
Probable Submitter: 86.160.186.210 (proxied: 86.160.186.210)
----
Manual Page -- http://www.php.net/manual/en/function.sprintf.php
Edit -- https://master.php.net/note/edit/93156
Del: integrated -- https://master.php.net/note/delete/93156/integrated
Del: useless -- https://master.php.net/note/delete/93156/useless
Del: bad code -- https://master.php.net/note/delete/93156/bad+code
Del: spam -- https://master.php.net/note/delete/93156/spam
Del: non-english -- https://master.php.net/note/delete/93156/non-english
Del: in docs -- https://master.php.net/note/delete/93156/in+docs
Del: other reasons-- https://master.php.net/note/delete/93156
Reject -- https://master.php.net/note/reject/93156
Search -- https://master.php.net/manage/user-notes.php