The explode function is being used for converting strings into an array variable by separating the values.
php developer Syntax :
Syntax Explanation:
The delimiter parameter is defining the separator operator.
Second parameter is defining the content string.
learn php Sample Code :
php for beginners Code Explanation :
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 ‘ – ‘).
Variable “$var2” is used for counting the number of values presented in the variable “$var1”.
In this statement we use for loop for processing the array value.
Here, we display the value of the variable “$var1” in the browser using “echo” statement.
php coding Sample Output :
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.