From: Trevor O. <tr...@gm...> - 2009-02-20 23:47:03
|
I'd probably use preg_match_all, or your method, depending on what sort of data i was parsing. Here's some funny behavior I saw yesterday, but is also as intended. One expects x%10 to always return a number between 0 and 9 inclusive. However, -16%10 is -6. The answer makes sense (-16/10 = -1r-6) but I kind of expected it to just add another 10 onto it, so it became 4. For my expected behavior, I had to say ((x%y)+y)%y 2009/2/20 Arlo Leach <ar...@ar...> > > "If delimiter contains a value that is not contained in string , then > > explode() will return an array containing string" > > > > So, since your string doesn't contain a "|" is returns the "array" of an > > empty string. Make sense? > > That does make sense -- so PHP is functioning as documented. But does this > seem like the right behavior to others? I think it would be the expected > behavior if $string is not empty, but if $string is empty, I would expect > $array to be empty, too, regardless of the delimiter. > > Or, if this is a hopeless cause, does anyone have a better workaround than > my little conditional check? > > Thanks! > > -Arlo > > _______________________________ > > Arlo Leach > 773.769.6106 > http://arlomedia.com > > > > > > ------------------------------------------------------------------------------ > Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, > CA > -OSBC tackles the biggest issue in open source: Open Sourcing the > Enterprise > -Strategies to boost innovation and cut costs with open source > participation > -Receive a $600 discount off the registration fee with the source code: > SFAD > http://p.sf.net/sfu/XcvMzF8H > _______________________________________________ > chiPHPug-discuss mailing list > chi...@li... > https://lists.sourceforge.net/lists/listinfo/chiphpug-discuss > -- -Trevor Oldak |