PHP Find and replace after in a string?
Posted
by
TheBlackBenzKid
on Stack Overflow
See other posts from Stack Overflow
or by TheBlackBenzKid
Published on 2012-10-30T16:38:52Z
Indexed on
2012/10/30
17:01 UTC
Read the original article
Hit count: 343
I have some strings which contain the words LIMIT 3, 199
or LIMIT 0, 100
.
Basically I want to replace the word LIMIT and everything after it in my string.
How do I do this in PHP? str_replace only replaces an item and the LIMIT text after is dynamic/
So it could be
WHEN JOHN WAS TRYING HIS SQL QUERY, HE FOUND THAT LIMIT, 121
// RETURN WOULD BE
WHEN JOHN WAS TRYING HIS SQL QUERY, HE FOUND THAT
WHEN JOHN TRIED LIMIT 343, 333 HE FOUND
// RETURN WOULD BE
WHEN JOHN TRIED
© Stack Overflow or respective owner