Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Apr 2015
    Location
    New Delhi
    Posts
    679

    How to convert string to array in php?

    Hello Friends,

    Please Provide me solutions.....

  2. #2
    Member
    Join Date
    Jun 2015
    Location
    Thailand
    Posts
    89
    Converts a string to an array

    array str_split ( string $string [, int $split_length = 1 ] )

  3. #3
    Registered User
    Join Date
    Aug 2015
    Posts
    2
    we can convert string to array in php like following:

    <?php

    $str = "Hello Friend";

    $arr1 = str_split($str);
    $arr2 = str_split($str, 3);

    print_r($arr1);
    print_r($arr2);

    ?>

  4. #4
    Registered User
    Join Date
    Sep 2015
    Posts
    270
    <?php
    // Example 1
    $pizza = "piece1 piece2 piece3 piece4 piece5 piece6";
    $pieces = explode(" ", $pizza);
    echo $pieces[0]; // piece1
    echo $pieces[1]; // piece2
    ?>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

  Find Web Hosting      
  Shared Web Hosting UNIX & Linux Web Hosting Windows Web Hosting Adult Web Hosting
  ASP ASP.NET Web Hosting Reseller Web Hosting VPS Web Hosting Managed Web Hosting
  Cloud Web Hosting Dedicated Server E-commerce Web Hosting Cheap Web Hosting


Premium Partners:


Visit forums.thewebhostbiz.com: to discuss the web hosting business, buy and sell websites and domain names, and discuss current web hosting tools and software.