Let’s say I have an array that store like this:
Array (
[0] => width: 650px;border: 1px solid #000;
[1] => width: 100%;background: white;
[2] => width: 100%;background: black;
)
How should I make the array[0] string split into piece by separated the ";"? Then I want to save them in array again, or display them out. How should I do it?
Array(
[0] => width: 650px
[1] => border: 1px solid #000
)
I would personally use the
preg_splitto get rid of that extra array element that would occur from the final semicolon…Edit: Don’t add the semicolon to each line:
Which should output:
Unlike explode, which should output: