About 24,000 results
Open links in new tab
  1. PHP explode() Function - W3Schools

    Break a string into an array: $str = "Hello world. It's a beautiful day."; The explode () function breaks a string into an array. Note: The "separator" parameter cannot be an empty string. Note: This function is binary-safe. explode (separator,string,limit) Required. Specifies where to break the string. Required. The string to split. Optional.

  2. Converting String to Array in PHP Using Different Methods

    Apr 12, 2025 · Understand the need to convert string to array in PHP and explore the complete list of methods used to convert a string to an array in PHP. Start learning now!

  3. php - Convert a String into an Array of Characters - Stack Overflow

    $string = "abcdef"; $resultArr = []; $strLength = strlen($string); for ($i = 0; $i < $strLength; $i++) { $resultArr[$i] = $string[$i]; } print_r($resultArr); Output: Array ( [0] => a [1] => b [2] => c [3] => d [4] => e [5] => f )

  4. php - Split a string containing words into an array of individual …

    how to convert a string in array in php i.e $str="this is string"; should be like this. arr[0]=this arr[1]=is arr[2]=string The str_split($str, 3); splits the string in 3 character word but I need to convert the string after whitespace in an array.

  5. Convert a String into an Array of Characters in PHP

    Jul 19, 2024 · The str_split() function is used to convert the given string into an array. This function basically splits the given string into smaller strings of length specified by the user and stores them in an array and returns the array.

  6. php - String "array" to real array - Stack Overflow

    You could write the string to a file, enclosing the string in a function definition within the file, and give the file a .php extension. Then you include the php file in your current module and call the function which will return the array. You'd have to use eval().

  7. 7 Ways To Convert String To Array In PHP - Code Boxx

    Nov 13, 2023 · This quick tutorial will walk you through various ways to convert a string to an array in PHP. Free example code download included.

  8. How To Convert PHP String to Array - Phpflow.com

    Sep 24, 2022 · There is a number of ways to convert a String to an Array in PHP. We’ll discuss explode (), preg_split () and str_split () methods with example. PHP provides functions that convert strings to arrays. The explode () function separates a string …

  9. 6 Functions to Convert String to Array in PHP | Radpointer

    Mar 6, 2025 · In this brief tutorial, we will explore various PHP functions that can be used to convert strings to arrays, diving into their details, use cases, and examples. 1. The explode() Function. The explode() function is one of the most widely …

  10. PHP String to Array Conversion with Examples – 4 Easy Ways

    May 27, 2022 · When you have a string but want to store that string in the database as a Array or there are some transformation you want to do based on that string, you may need to transform that string to array. There are several methods. explode() function; preg_split() str_split; str_word_count; But easiest one is using the explode function. The explode ...

  11. Some results have been removed
Refresh