<?php
$output = listelements();
$array = explode("<li>", $output);
//First element will be empty, so remove it
unset($array[0]);
// Now remove "</li>" at end of input
array_walk($array, create_function('&$val', '$val = str_replace("</li>", "", $val)'));
// $array should now contain your elements
Answer from iblue on Stack OverflowWtools
wtools.io βΊ convert-list-to-php-array
Convert List to PHP Array Online - wtools.io
Free tool for online converting text list into appropriate PHP type as Array, generate PHP array from list quickly.
Listtoarray
listtoarray.com
List to Array Online Converter: Convert your text list into array online
Use this online list to array converter tool to convert your lengthy text lists or numerical lists into arrays. You can convert your lists into arrays online for Javascript, PHP, PERL, C#, Python, Java or any other supported programs.
Convert list into an array using php. How? - Stack Overflow
I have a function called listelements(), which outputs text like text1 text2 . I have more than 500 elements. Now I want to convert it into an array. Can a... More on stackoverflow.com
How can I turn a list of items into a php array? - Stack Overflow
word 1 word 2 word 3 word 4 And so on... How can I turn that into a php array, here will be a lot of items so I don't want to write them all out into an array manually and I know there has to be a More on stackoverflow.com
Transform php array into a list of values - Stack Overflow
I have a php array of key => value, and I would like to store all the values into a list (like a python list) of values. I need it cause I have to pass this list of values to a JQuery script. Basi... More on stackoverflow.com
arrayThis = Instantly convert your text list to array; valid for JS, PHP, PERL, PYTHON (as list) and much more. Hope it might help.
Love this. More on reddit.com
Is the Text List To Array [ ] free to use?
Yes, the Text List To Array [ ] on Easy Code Tools is 100% free. No account, subscription, or payment is required. Just open the page and start using it immediately β no sign-up, no waiting.
easycodetools.com
easycodetools.com βΊ home βΊ coding tools βΊ text list to array [ ]
Text List To Array [ ] | Easy Code Tools
Is the Text List To Array [ ] completely free?
Yes β the Text List To Array [ ] is 100% free to use. There are no hidden charges, no subscriptions, and no account required. Just open the page and start using it right away.
easycodetools.com
easycodetools.com βΊ home βΊ coding tools βΊ text list to array [ ]
Text List To Array [ ] | Easy Code Tools
How accurate is the Text List To Array [ ]?
The Text List To Array [ ] is built to deliver accurate, reliable results. It processes your input using established algorithms and runs entirely in your browser for maximum speed and consistency.
easycodetools.com
easycodetools.com βΊ home βΊ coding tools βΊ text list to array [ ]
Text List To Array [ ] | Easy Code Tools
arrayThis
arraythis.com
Online array converter; convert your text list to array | arrayThis
Instantly convert your text list to array using arrayThis online tool; valid arrays for JS, PHP, PERL, Python and much more.
ArrayText
arraytext.com
Convert your text list to array online | Text to array converter
Convert your text list into an array online using ArrayText. Supports formatting for JavaScript, JSON, Python, PHP, Java, C#, Go, Ruby, Rust, SQL, and more.
Top answer 1 of 5
3
<?php
$output = listelements();
$array = explode("<li>", $output);
//First element will be empty, so remove it
unset($array[0]);
// Now remove "</li>" at end of input
array_walk($array, create_function('&$val', '$val = str_replace("</li>", "", $val)'));
// $array should now contain your elements
2 of 5
2
explode won't do the trick nicely for html tags (considering them as multiple delimiters).
if CPU time is not a concern, try using preg_match, example below:
<?PHP
$input='<li>text1</li><li>text2</li><LI><p>text3</p></lI><Li>text fou4r</li>';
preg_match_all('(<(li|Li|LI|lI)>(.*)</(li|Li|LI|lI)>)siU', $input, $output);
print_r($output[2]);
?>
output:
Array
(
[0] => text1
[1] => text2
[2] => <p>text3</p>
[3] => text fou4r
)
Top answer 1 of 5
9
If you mean:
word1 word2 word3
Then you want
$array = explode(' ', "word1 word2 word3");
If you actually mean "word 1 word 2 word 3", with numbers inbetween, then you'll need to get a little fancier with preg_split()
2 of 5
1
if you have all your words in a text file, one per line you can use the file function which will read the whole file into an array, one item per line
http://nz.php.net/manual/en/function.file.php
Easy Code Tools
easycodetools.com βΊ home βΊ coding tools βΊ text list to array [ ]
Text List To Array [ ] | Easy Code Tools
September 9, 2026 - The List to Array Generator allows users to easily convert a list of items into an array, with the option to select the format of the output array, such as JSON, Python, PHP, and more.
Cliptics
cliptics.com βΊ text-to-array-converter-online
Text to Array Converter Online | Convert List to Array Free
Convert text lists to arrays in JavaScript, Python, PHP, Java, C#, SQL. Advanced preprocessing with real-time conversion for developers.
TutorialsPoint
tutorialspoint.com βΊ article βΊ reading-and-storing-a-list-as-an-array-php
Reading and storing a list as an array PHP
March 15, 2026 - <?php $list = "10 20 30 40 50 60"; ... $current_number; } foreach($arr as $value) { echo $value . "<br>"; } ?> ... Use explode() for splitting strings into arrays as it's built-in, efficient, and readable....
Tool4geeks
tool4geeks.com βΊ devs-utility βΊ list-to-array-online
List to Array Online - Tool4Geeks
To use the list to array converter tool, you simply need to provide the list of values that you want to convert. The tool will then convert the list into an array and return the array to you. You can also select the language or mode that you want your output to be in.
JSFiddle
jsfiddle.net βΊ greenpioneer βΊ e9fsc5wb
Convert List to Array - JSFiddle - React, Tailwind, and code Playground
Adding External Resources will no longer create a list of resources in the sidebar but will be injected as a LINK or SCRIPT tag inside of the HTML panel.
Wtools
wtools.io βΊ convert-csv-to-php-array
Convert CSV to PHP Array Online - wtools.io
Free tool for online converting CSV into appropriate PHP type as Array.
Address: 5851 Legacy Circle, 6th Floor, Plano, TX 75024 United States
Dyn-web
dyn-web.com βΊ php βΊ strings βΊ convert.php
How to Convert Strings to Arrays in PHP
Pass a delimiter and a string to the explode function, and it will split the string into array elements where it finds the delimiter. The delimiter can be a single character (such as a space or a comma), or it can consist of multiple characters. In the following example, a string contains a ...
Nextjson
nextjson.com βΊ array
List to Array Converter Online - NextJSON
Convert lists to arrays with different styles. Free online line to array converter. Calculate both the sum and average. Remove duplicates line from list.
Reddit
reddit.com βΊ r/sideproject βΊ arraythis = instantly convert your text list to array; valid for js, php, perl, python (as list) and much more. hope it might help.
r/SideProject on Reddit: arrayThis = Instantly convert your text list to array; valid for JS, PHP, PERL, PYTHON (as list) and much more. Hope it might help.
October 22, 2020 -
https://arraythis.com/
Why this? Because I needed a quick tool for passing portions of data (data excel columns, text lists, etc.) to array. Hope it helps you too.
OnlinePHP
onlinephp.io βΊ array
array - Online Tool
Execute and test array with this online tool