Basic PHP Programming Question:
Download Job Interview Questions and Answers PDF
How to split a string into array using php?
Answer:
$myString = "My Name Is Muhammad Hussain";
$myArray = explode(' ', $myString);
print_r($myArray);
Output :
Array
(
[0] => My
[1] => Name
[2] => Is
[3] => Muhammad
[4] => Hussain
)
$myArray = explode(' ', $myString);
print_r($myArray);
Output :
Array
(
[0] => My
[1] => Name
[2] => Is
[3] => Muhammad
[4] => Hussain
)
Download PHP Interview Questions And Answers
PDF
Previous Question | Next Question |
How To Read the Entire File into a Single String? | Table rename? |