AgerNic.com
Start write and run your php code online
HOME Editor | PHP Exemples | PHP Functions |
WEB TEMPLATES | EXAMPLES
PHP Tutorial
PHP explode() function, run and write PHP code.

PHP explode() function - online editor.

PHP explode() function is a built in function in PHP. Explode() function is used to split a string in different strings.

Syntax
array explode(separator, OriginalString, NoOfElements)

Exemple :
explode() function - used to split a string in different strings:
        

<?php
$str = 'monday,thursday,wednesday,tuesday,fridayr';

echo '<pre>';

// zero limit
print_r(explode(',',$str,0));
print "<br>";

// positive limit
print_r(explode(',',$str,2));
print "<br>";

// negative limit
print_r(explode(',',$str,-1)); echo '</pre>';
?>



Exemple :
explode() function - used to split a string in different strings:
  <?php 

// my_string
$my_string = "Hello, How are you today?";
echo '<pre>';
// Without optional parameter NoOfElements
print_r(explode(" ",$my_string));

// with positive NoOfElements
print_r(explode(" ",my_string,3));

// with negative NoOfElements
print_r(explode(" ",$my_string,-1));
echo '</pre>'; ?>


Tags:
php explode function
PHP explode() function

PHP Functons
PHP count() Function

PHP define() function

PHP empty() Function

PHP explode() function

PHP html_entity_decode() function

PHP htmlentities() function

PHP htmlspecialchars_decode() function

PHP htmlspecialchars() function

PHP implode() function

PHP isset() Function

PHP lcfirst() function

PHP ltrim() function

PHP md5() function

PHP print() function

PHP printf() function

PHP rtrim() function

PHP similar_text() function

PHP str_repeat() function

PHP str_replace() function

PHP str_split() function

PHP strcmp() function

PHP strip_tags() function

PHP strlen() function

PHP strrchr() Function

PHP strstr() function

PHP strtolower() function

PHP strtoupper() function

PHP substr() function

PHP trim() function

PHP ucfirst() function