Level 75
Do this separate like in controller.
1 like
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
How can I create an array from an ordered list, with the number as the index/key and the list item as the array value?
Example list:
<ol>
<li>First list item</li>
<li>Second list item</li>
<li>Third list item</li>
</ol>
Should result in:
{"1" => "First list item", "2" => "Second list item", "3" => "Third list item"}
I tried using Array.from() with a few variations but that didn't work
Please or to participate in this conversation.