Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Convert a string to array in php

    • 0
    • 1
    • 1
    • 2
    • 0
    • 0
    • 0
    • 0
    • 311
    Comment on it

    We can convert string to array using php predefined function named as explode().

    Syntax for explode is:

    explode('separator',string);

    Example -

     $string = "This is a text";
     $split_data = explode('',$string); // splitting by space as a separator
     

    Print the $split_data variable and Output is like

     $split_data [0] = 'This';
     $split_data [1] = 'is';
     $split_data [2] = 'a';
     $split_data [3] = 'text';
     

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: