Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 27c66b1329522147a7556322a54c1562 > files > 8

php-amf-0.9.1-11mdv2009.1.i586.rpm

<?php

// it provides the functions for the AMF StringBuilder based on strings
if(!extension_loaded("amf"))
{
	function amf_sb_new()
	{
		return "";
	}

	function _amf_sb_append(&$sb,$a)
	{
		foreach($a as $v)
		{
			if(is_array($v))
				_amf_sb_append($sb,$v);
			else
				$sb .= $v;
		}
	}
	
	function amf_sb_append(&$sb)
	{
		$n = func_num_args();
		$r = $sb;
		for($i = 1; $i < $n; $i++)
		{
			$aa = func_get_arg($i);
			if(is_array($aa))
			{
				_amf_sb_append($r,$aa);
			}
			else
				$r .= $aa;
		}
		$sb = $r;
	}

	function amf_sb_length(&$sb)
	{
		return strlen($sb);
	}
	
	function amf_sb_write(&$sb,$stream=NULL)
	{
		if($stream == NULL)
			echo($sb);
		else
			fwrite($stream,$sb);
	}
    
    function amf_sb_echo(&$sb)
	{
		echo($sb);
	}
	
	function amf_sb_as_string(&$sb)
	{
		return $sb;
	}
    
	function amf_sb_flat(&$sb)
	{
		return $sb;
	}
}

?>