/**
* net_conv_arrayToURLStr
*
* Converts an array to a url string.
* @param $arr - array to convert to url string.
* @param $prefix - string. If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only.
* @param $arg_separator - arg_separator.output is used to separate arguments, unless this parameter is specified, and is then used.
* Credit: mqchen at gmail dot com
* @return string.
*/
function net_conv_arrayToURLStr($arr,$prefix=null,$arg_separator=null){
if(!function_exists('http_build_query')){
$s = http_build_query($arr, $prefix, $arg_separator);
}
else{
$ret = array();
foreach((array)$arr as $k => $v) {
$k= urlencode($k);
if(is_int($k) && $prefix != null) {
$k = $prefix.$k;
};
if(!empty($key)) {
$k = $key."[".$k."]";
};
if(is_array($v) || is_object($v)) {
array_push($ret,arrayToURLStr($v,"",$arg_separator,$k));
}
else {
array_push($ret,$k."=".urlencode($v));
};
};
if(empty($sep)) {
$sep = ini_get("arg_separator.output");
};
$s = implode($sep, $ret);
}
return $s;
}
PHP and javascript snippets you can copy and paste.
Showing posts with label php array string conversion net_conv_url arrayToURLStr(). Show all posts
Showing posts with label php array string conversion net_conv_url arrayToURLStr(). Show all posts
Friday, March 16, 2007
Subscribe to:
Posts (Atom)
Blog Archive
-
▼
2007
(71)
-
▼
June
(20)
- js_move_elementToYPos(element, yPoint)
- js_move_elementToXPos(element, xPoint)
- js_move_elementHorizontal(element, shiftHoriz)
- js_move_elementVertical(element, shiftVertical)
- js_get_rand(max)
- js_get_isEven(n)
- js_is_odd(n)
- js_get_screenCenterY()
- js_get_screenCenterX()
- js_get_elementTop()
- js_get_elementLeft()
- js_get_elementHeight()
- js_get_elementWidth
- js_get_pageWidth()
- js_get_pageHeight()
- js_get_scrollTop()
- js_get_scrollLeft()
- js_get_browserInnerHeight
- js_get_browserInnerWidth
- js_get_pageInnerWidth
-
▼
June
(20)