PHP explode() function

This function is used to split a string into multiple strings based on the specified delimiter.

Syntax

explode(delimeter, string);

The delimiter is the required parameter. It is a string or character and set as a boundary to split the string. The string is also the required parameter.

Example

<?php
    $str = " Sam, John, Smith, Bini";
    $name = explode(',', $str);
    print_r($name);
?>


Output :

Array ( [0] => Sam [1] => John [2] => Smith [3] => Bini )



Related PHP Functions

PHP array_reverse() function
PHP array_diff() function
PHP array_key_exists() function
PHP array_push() function
PHP array_search() function
PHP class_exists() function
PHP curl_setopt() function
PHP die() function
PHP dirname() function
PHP each() function
PHP explode() function
PHP file_exists() function
PHP function_exists() function
PHP getenv() function
PHP is_readable() function
PHP ksort() function
PHP mkdir() function
PHP ob_start() function
PHP parse_url() function
PHP str_repeat() function
PHP substr() function




Read more articles


General Knowledge



Learn Popular Language