Hey there! any question in your mind? Ask It Now!.

Popular Categories





How to remove a specific string from array in PHP?

+2 votes
153 views
asked in Programming by nishant (380 points)
retagged by Bhartesh

I have an array in which links and titles  are stored like this :

$array = array();

foreach($books as $img) 
{

$array[$title] = $src;

}

Now in title some unwanted characters are coming i want to remove  replace those characters from array.Thanks for help!

1 Answer

+1 vote
answered by nitin (810 points)

There is a simple function for the same see:

lets say you want to remove asdf from a string $title  which is

$title = “Appleasdf ” ;

str_replace('asdf','', $title)


Here we have replaced asdf from blank so now your string is

$title = “Apple”;

I hope you would use this according to your need.

Related Questions

+4 votes
5 answers 732 views
–1 vote
0 answers 126 views
+2 votes
3 answers 292 views
asked in Programming by jatin Expert (3,823 points)
+3 votes
1 answer 720 views
+2 votes
2 answers 796 views
+2 votes
1 answer 607 views
+6 votes
2 answers 2,575 views
+1 vote
1 answer 95 views
+1 vote
1 answer 154 views

Not a Member yet?

Ask to Folks Login

My Account
685 Folks are online
0 members and 685 guest online
Your feedback is highly appreciated