note 82247 deleted from function.implode by felipe

From: Date: Thu, 03 Apr 2008 01:37:42 +0000
Subject: note 82247 deleted from function.implode by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-137876@lists.php.net to get a copy of this message
Note Submitter: wesleys at opperschaap dot net ---- The previous p_join function had some bugs, and code which got repeated. Changed it a bit, so here it is: function p_join() { $args = func_get_args(); if (count($args) > 1) { $result = ""; $sep = array_shift($args); foreach ($args as $val) { if (is_array($val)) { if (is_assoc_array($val)) { $result .= _p_join_assoc($sep, $val); } else { $result .= $sep . _p_join_array($sep, $val); } continue; } $result .= $sep . $val; } # $result will always start with a $sep, so remove it.. return substr_replace($result, "" ,0, strlen($sep)); } trigger_error(sprintf("%s requires at least 2 parameters", __FUNCTION__), E_USER_WARNING); return null; }

« previous php.notes (#137876) next »