|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2002-07-05 15:19 UTC] sniper@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Dec 12 22:00:02 2025 UTC |
I have a function that takes a variable number of arguments and uses func_get_args to retrieve them as an array. In one place when I call this function with two arguments a third, empty argument is added. As the function is used to generate SQL 'where' clauses by joing strings with ' and ', this caused a sever problem to my system! I have added an explicit test for null strings in the function and this has worked round the problem. I use this function in many places in my code and only this one call has problems. Here is the function, you can see the work round code I added. function dband() { $args = func_get_args(); $str = jval(array_shift($args)); foreach ($args as $v) { # if ($v != '') # { $str .= ' and '.jval($v); # } } return $str; } I had another version of this function that tried to use array functions to achieve this result but I could not get it to work reliably, but for reasons other than extra arguments.