Derek Fandt
Derek Fandt

Reputation: 3

cut text in PHP

i have for example:

$one =
aaaa
bbbbb
cccc
dddd
eeeee
dsfas
fsadf
asdf;

i would like return all for eeeee:

$two = somefunction($one);

echo $two =

eeeee
dsfas
fsadf
asdf;

thanks for help!

$one and $two are string!

Upvotes: 0

Views: 117

Answers (1)

DaveRandom
DaveRandom

Reputation: 88647

There are a million ways to do this, but for doing exactly what you describe. strstr() is probably simplest:

$two = strstr($one,'eeeee');

If you can give us more of a real-world example, we might recommend somthing else...

Upvotes: 3

Related Questions