This might be an easy thing to fix but i still have to ask because it should not be happening in the first place.
I have this simple string: 24.00C 48%
Now when using the explode()
function on this string it should return an Array with 2 Elements.
$str = "24.00C 48%";
$str_array = explode(" ", $str);
Expected Result
$str_array[0] = 24.00C
$str_array[1] = 48%
What actually happens
The first element of the array is correct and it contains what it should (24.00C
) now the second element of the array was empty so i checked what the array actually contains using print_r
Now what it returned is what confuses me the most.
Array ( [0] => 24.00C [1] => [2] => [3] => [4] => [5] => [6] => [7] => 48% )
As you can see the first element is fine but after that its not really doing what it should..
Now my questions are:
Does anyone know why this is happening and how to make explode
work properly?
Also why is the 48%
the 7th Element and not the 3rd as example is there any specific reason for that?