Level 60
Hi,
explode(',', '1,2,3,4,5,6');
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello,
Current i have an string in mine DB: 1,2,3,4,5,6, How i can convert this in array and separate them from each? How i can take only 3 from this string?
// creates an array
explode(',' $string)
// takes first three elements
array_slice($array, 0, 3)
// together
array_slice(explode(',', $string), 0, 3)
Please or to participate in this conversation.