php tutorial - PHP explode Function - php programming - learn php - php code - php script




  • The explode function is being used for converting strings into an array variable by separating the values.

php developer Syntax :

explode(delimiter, string);
click below button to copy the code. php tutorial - team

Syntax Explanation:

  • The delimiter parameter is defining the separator operator.
  • Second parameter is defining the content string.

learn php Sample Code :

<!DOCTYPE html>
<html>
    <body>
        <?php
            $var1 = explode('-', "wikitechy-is-a-technical-website");
	    $var2 = count($var1);

            for($x=0;$x<$var2;$x++)
	    {
	       echo $var1[$x];
	       echo "<br>";
	    }
        ?>
    </body>
</html>
click below button to copy the code. php tutorial - team

php for beginners Code Explanation :

Code Explanation for Explode Function In PHP

  1. In this statement we define the value for the variable $var1 and the explode function is used for splitting the element value according to the specified operator (Here we used the operator ‘ – ‘).
  2. Variable “$var2” is used for counting the number of values presented in the variable “$var1”.
  3. In this statement we use for loop for processing the array value.
  4. Here, we display the value of the variable “$var1” in the browser using “echo” statement.

php coding Sample Output :

output for Explode Function In PHP

  1. The output statement is, “wikitechy-is-a-technical-website” the term will be splited according to the hyphen (-) and the output will be shown as above.


Related Searches to php explode function

Adblocker detected! Please consider reading this notice.

We've detected that you are using AdBlock Plus or some other adblocking software which is preventing the page from fully loading.

We don't have any banner, Flash, animation, obnoxious sound, or popup ad. We do not implement these annoying types of ads!

We need money to operate the site, and almost all of it comes from our online advertising.

Please add wikitechy.com to your ad blocking whitelist or disable your adblocking software.

×