Jump to content

Archived

This topic is now archived and is closed to further replies.

raila

separate strings

Recommended Posts

I have a textfile that contains the following:
< 0> Brann
< 0> Fredrikstad
<4> viking

i whant to separate the "< 0>" (everything between < & >) and the "Name" after the < & >
When i have separated the string i whant to echo"Name" (i.e Brann or Fredrikstad or viking)
whitout the < > and everything between them.

Need all the help i kan get.
thank Raila.

Share this post


Link to post
Share on other sites
try

[code]$str = '< 0> Fredrikstad';

list(,$number,$name) = split ('[<>]', $str);

echo $number; // --> 0
echo $name; // --> Fredrikstad[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.