本文整理汇总了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;
}