chris227 chris227 - 22 days ago 5x
PHP Question

Select names from a string using php

Hello I have the following string and I want to keep only what is after


here is my string :

/showname/88820665 : Jysk diner
/showname/88820666 : Sevecu
/showname/88820667 : Luminex Lightcares
/showname/88820668 : Pactius
/showname/88820669 : Aalborg Speciallaegeklinik


You can use explode()

 $pieces = explode(":", $myString);

 echo $pieces[1];  // should contain  the right part of the string after :

In you have a single row string then

  $myRows= explode("\n", $myString);

  foreach( $myRows as $key => $value) {
    $pieces = explode(":", $value);
    echo $pieces[1];