How can I remove substring from an array and we are fetch data from the database?

StackOverflow https://stackoverflow.com/questions/18731052

  •  28-06-2022
  •  | 
  •  

Question

I want to remove only development and want to fetch rest of the array?

Menus is table having one column with below names:

  • web Development
  • App Development
  • Digital stratergy
  • graphic Team

I need this should be come in below fromat web, graphic team, app, Digital stratergy

I am able to get in same order but unable to remove development.. I tried below code. Thanks for help in advance.

foreach($requiredOrderForService as $index){
    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'))));
    echo "<br>";

}
Était-ce utile?

La solution

I am not familiar with cakephp but based on the response to my comment you can do something like this,

foreach($requiredOrderForService as $index){
   echo  urldecode(strtoupper($this->Html->link(str_replace('Development','',$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'))));
   echo "<br>";

}
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top