<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Denover &#187; array function</title>
	<atom:link href="http://denover.com/tag/array-function/feed" rel="self" type="application/rss+xml" />
	<link>http://denover.com</link>
	<description>Блог для всех и обо всём</description>
	<lastBuildDate>Sat, 28 Jan 2012 18:52:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>PHP function for make JSON</title>
		<link>http://denover.com/php-function-for-make-json/166?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=php-function-for-make-json</link>
		<comments>http://denover.com/php-function-for-make-json/166#comments</comments>
		<pubDate>Fri, 07 Nov 2008 03:01:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Новости]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[array function]]></category>
		<category><![CDATA[foreach]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.denover.com/?p=166</guid>
		<description><![CDATA[PHP function for make JSON from array function cff_php2js($a) { if (is_null($a)) return 'null'; if ($a === false) return 'false'; if ($a === true) return 'true'; if (is_scalar($a)) { $a = addslashes($a); $a = str_replace("\n", '\n', $a); $a = str_replace("\r", '\r', $a); $a = preg_replace('{(&#60;/)(script)}i', "$1'+'$2", $a); if (is_numeric($a)) return "$a"; else return "'$a'"; } [...]]]></description>
			<content:encoded><![CDATA[<p>PHP function for make JSON from array</p>
<p><span id="more-166"></span></p>
<p><code> function cff_php2js($a)<br />
{<br />
if (is_null($a)) return 'null';<br />
if ($a === false) return 'false';<br />
if ($a === true) return 'true';<br />
if (is_scalar($a)) {<br />
$a = addslashes($a);<br />
$a = str_replace("\n", '\n', $a);<br />
$a = str_replace("\r", '\r', $a);<br />
$a = preg_replace('{(&lt;/)(script)}i', "$1'+'$2", $a);<br />
if (is_numeric($a))<br />
return "$a";<br />
else<br />
return "'$a'";<br />
}<br />
$isList = true;<br />
for ($i=0, reset($a); $i&lt;count($a); $i++, next($a))<br />
if (key($a) !== $i) { $isList = false; break; }<br />
$result = array();<br />
if ($isList) {<br />
foreach ($a as $v) $result[] = cff_php2js($v);<br />
return '[ ' . implode(', ', $result) . ' ]'."\n";<br />
} else {<br />
foreach ($a as $k=&gt;$v)<br />
$result[] = cff_php2js($k) . ': ' . cff_php2js($v);<br />
return '{ ' . implode(", ", $result) . ' }'."\n";<br />
}<br />
}</code></p>
]]></content:encoded>
			<wfw:commentRss>http://denover.com/php-function-for-make-json/166/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

