All pastes #162993 Raw Edit

Stuff

public text v1 · immutable
·published 2006-09-07 01:31 UTC
rendered paste body
 function modified_array_walk_recursive(&$input, $funcname, $userdata = "")
 {
	 if (!is_callable($funcname))
	 {
		 return false;
	 }
	 
	 if (!is_array($input))
	 {
		 return false;
	 }
	 
	foreach ($input AS $key => $value)
	{
		if (is_array($input[$key]))
		{
			modified_array_walk_recursive($input[$key], $funcname, $userdata);
		}
		else
		{
			$saved_value = $value;
			if (!empty($userdata))
			{
				$funcname($value, $key, $userdata);
			}
			else
			{
				$funcname($value, $key);
			}
			 
			if ($value != $saved_value)
			{
				$input[$key] = $value;
			}
		}
	}
	return true;
}


function download_value($item, $key) 
{
	if (stristr($key, 'download'))
		return $item;
}
function play_value($item, $key) 
{
	if (stristr($key, 'play'))
		return $item;
}

$variable= modified_array_walk_recursive($file_desc_array, 'download_value');