-1

我有以下数组。我想从数组中删除 gupta 并想返回剩余的数组。

$array = array('dave gupta', 'stephen gupta', 'rajni goel');
$substring want to delete gupta

需要输出=>

$array = array('dave', 'stephen', 'rajni');

提前感谢您的帮助。

在我的实际代码中

$this->Html->link($serv[$index]['Service'] => by this I can getting all the value from the data base.

我的价值观是

Web Development
Graphic design
App Development
Digital design

我只想删除开发并想获取阵列的其余部分?

echo  urldecode(strtoupper($this->Html->link($serv[$index]['Service']['name'],array('controller' => $serv[$index]['Service']['controller'],
                   'action' => $serv[$index]['Service']['action'],$serv[$index]['Service']['id'],
                   'admin' => false,
                   'plugin' => false),array('class'=>'menuForFooter2'))));
4

1 回答 1

-1

array_filter适合这种情况。

$array = array('dave', 'gupta','stephen', 'gupta','rajni', 'goel');
$output=array_filter($array, function($s){return $s!='gupta';});
于 2013-09-11T00:04:07.427 回答