Explode question: second piece when string at end of explode
Posted: Wed Jul 15, 2009 8:05 pm
I am looking for some clarification about PHP's explode function. If I explode a string with another string that occurs at the end of the string I'm exploding it does create an empty second piece...
...I'm curious if this is intentional or simply something that has been overlooked in PHP that might be "ironed out" in PHP 6 or 7 (in which case I'd prefer to find something that wouldn't be considered a "fluke"). It would be more convenient that it's intentional though I'd like to cover my bases just in case. Thought please?
Code: Select all
<?php
$i_r_exploder = explode("world","hello world");
?>