本文整理匯總了PHP中sfToolkit::removeArrayValueForPath方法的典型用法代碼示例。如果您正苦於以下問題:PHP sfToolkit::removeArrayValueForPath方法的具體用法?PHP sfToolkit::removeArrayValueForPath怎麽用?PHP sfToolkit::removeArrayValueForPath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類sfToolkit
的用法示例。
在下文中一共展示了sfToolkit::removeArrayValueForPath方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: array
'bar' => array(
'baz' => 'foo bar',
),
),
'bar' => array(
'foo',
'bar',
),
'simple' => 'string',
), '::removeArrayValueForPath() removes a key');
$t->is(sfToolkit::removeArrayValueForPath($arr, 'barfoo'), null, '::removeArrayValueForPath() returns null if the key does not exist');
$t->is(sfToolkit::removeArrayValueForPath($arr, 'barfoo', 'bar'), 'bar', '::removeArrayValueForPath() takes the default value as a third argument');
$t->is(sfToolkit::removeArrayValueForPath($arr, 'foo[bar][baz][booze]'), null, '::removeArrayValueForPath() is not fooled by php mistaking strings and array');
$t->is(sfToolkit::removeArrayValueForPath($arr, 'foo[simple][bad]'), null, '::removeArrayValueForPath() is not fooled by php mistaking strings and array');
$t->is(sfToolkit::removeArrayValueForPath($arr, 'foo[bar][baz]'), 'foo bar', '::removeArrayValueForPath() works with deep paths');
$t->is($arr, array(
'foo' => array(
'bar' => array(
),
),
'bar' => array(
'foo',
'bar',
),
'simple' => 'string',
), '::removeArrayValueForPath() works with deep paths');
// ::addIncludePath()
$t->diag('::addIncludePath()');
$path = get_include_path();
示例2: remove
public function remove($name, $default = null, $ns = null)
{
if (!$ns) {
$ns = $this->default_namespace;
}
$retval = $default;
if (isset($this->parameters[$ns]) && array_key_exists($name, $this->parameters[$ns])) {
$retval = $this->parameters[$ns][$name];
unset($this->parameters[$ns][$name]);
} else {
$retval = sfToolkit::removeArrayValueForPath($this->parameters[$ns], $name, $default);
}
return $retval;
}
示例3: remove
/**
* Remove a parameter.
*
* @param string $name A parameter name
* @param mixed $default A default parameter value
*
* @return string A parameter value, if the parameter was removed, otherwise null
*/
public function remove($name, $default = null)
{
$retval = $default;
if (array_key_exists($name, $this->parameters)) {
$retval = $this->parameters[$name];
unset($this->parameters[$name]);
} else {
$retval = sfToolkit::removeArrayValueForPath($this->parameters, $name, $default);
}
return $retval;
}