Sunday, December 4, 2011

explode() method

Code Example

split() method is deprecated in php 5.3. Instead of split()  use explode().

explode.php

<?php
$text= "hello friends how are you?";
$newtext= explode(' ', $text);
foreach ($newtext as $str){
    echo $str.'<br/>';
}
?>
output:
hello
friends
how
are
you?

No comments:

Post a Comment