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

Popular Categories





How to remove a specific string from array in PHP?

+2 votes
171 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 756 views
–1 vote
0 answers 145 views
+2 votes
3 answers 303 views
asked in Programming by jatin Expert (3,823 points)
+3 votes
1 answer 768 views
+2 votes
2 answers 799 views
+2 votes
1 answer 705 views
+6 votes
2 answers 2,765 views
+1 vote
1 answer 113 views
+1 vote
1 answer 168 views

Not a Member yet?

Ask to Folks Login

My Account
443 Folks are online
2 members and 441 guest online
Your feedback is highly appreciated