Using the explode() Function : explode « Data Structure « PHP

Using the explode() Function


    $input_string = "this is a test.";

    $pieces = explode(",", $input_string);

    echo "Names in List: <BR/>\n";
    foreach($pieces as $name) {
        echo trim($name) . "<BR/>\n";


Related examples in the same category

1.Breaking Strings into Arrays with explode()
2.Display year an individual was born
3.Generating an ID with microtime()
4.explode( ) function converts a string into an array using a separator value
5.explode() function divides string into various elements, returning these elements in an array.
7.Using explode() with date()
8.Processing variable-length text fields
9.Reading and Writing Comma-Separated Data