<?php function encodeParams($params) { if (is_array($params)) { $s =""; foreach ($params as $key => $val) { switch ($key) { default: $s .= $key ."=". urlencode($val) ."&"; break; } } return substr($s, 0, -1); } else { return""; } } ?>
Usage
Just pass the array of params to the function and get your encoded string ready to post returned.
0 comments:
Post a Comment