Solve the following problems
01
//http://blog.1dnet.net
02
function
_encode(
$arr
)
03
{
04
$na
=
array
();
05
foreach
(
$arr
as
$k
=>
$value
) {
06
$na
[_urlencode(
$k
)] = _urlencode (
$value
);
07
}
08
return
addcslashes
(urldecode(json_encode(
$na
)),
"rn"
);
09
}
10<code>10
11<code>11
function<code class="keyword">function
_urlencode(<code class="plain">_urlencode(
$elem<code class="variable">$elem
)<code class="plain">)
12<code>12
{<code class="plain">{
13<code>13
<code class="spaces">
if<code class="keyword">if
(<code class="plain">(
is_array<code class="functions">is_array
(<code class="plain">(
$elem<code class="variable">$elem
)){<code class="plain">)){
14<code>14
<code class="spaces">
foreach<code class="keyword">foreach
(<code class="plain">(
$elem<code class="variable">$elem
as<code class="keyword">as
$k<code class="variable">$k
=><code class="plain">=>
$v<code class="variable">$v
){<code class="plain">){
15<code>15
<code class="spaces">
$na<code class="variable">$na
[_urlencode(<code class="plain">[_urlencode(
$k<code class="variable">$k
)] = _urlencode(<code class="plain">)] = _urlencode(
$v<code class="variable">$v
);<code class="plain">);
16<code>16
<code class="spaces">
}<code class="plain">}
17<code>17
<code class="spaces">
return<code class="keyword">return
$na<code class="variable">$na
;<code class="plain">;
18<code>18
<code class="spaces">
}<code class="plain">}
19<code>19
<code class="spaces">
return<code class="keyword">return
urlencode(<code class="plain">urlencode(
$elem<code class="variable">$elem
);<code class="plain">);
20<code>20
}<code class="plain">}