Re: [PHP] slicing and dicing strings
On Wed, 27 Jun 2012, tamouse mailing lists wrote: RTFM with no hint of where to look is a problem. But the dictum of Read here in the manual will surely be the best thing. You will then know where to look for future questions. Personally, I've got better things to do with my time than spend it committing the syntax and semantics of every single PHP function to memory. I nearly always have the php.net front page with its function search open in a browser whenever I'm writing something more than a few lines. The function search seriously rocks. Even if I can't remember which string function I want, I can search for *any* string function and I'll get the list of all of them, along with a quick summary to help me find the one I want. Geoff. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] slicing and dicing strings
-Original Message- From: Geoff Shang [mailto:ge...@quitelikely.com] Sent: Thursday, June 28, 2012 5:12 AM To: php-general@lists.php.net Subject: Re: [PHP] slicing and dicing strings On Wed, 27 Jun 2012, tamouse mailing lists wrote: RTFM with no hint of where to look is a problem. But the dictum of Read here in the manual will surely be the best thing. You will then know where to look for future questions. Personally, I've got better things to do with my time than spend it committing the syntax and semantics of every single PHP function to memory. I nearly always have the php.net front page with its function search open in a browser whenever I'm writing something more than a few lines. The function search seriously rocks. Even if I can't remember which string function I want, I can search for *any* string function and I'll get the list of all of them, along with a quick summary to help me find the one I want. Geoff. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Geoff, The function you are looking for is SUBSTR(); I understand you have the manual open and you think you can find the answer pretty quickly. Please understand that knowing a little, to advanced features of all functions will help you significantly. It will cut down on research time and you have a better understanding of what function will better fit the situation at hand. While some people will never fully remember all syntax of every function it never hurt anyone in attempting to understand a majority of PHP functionality. :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] slicing and dicing strings
On Wed, Jun 27, 2012 at 6:15 PM, Kirk Bailey kbai...@howlermonkey.net wrote: ok, it slices and dices, but how? in python, to print all but the last char in string FOO, we say print FOO[:-1] But this seems to bark like a basset hound in php. Whyfore? It is a longer syntax which, in agreement with some folks, I think could be shortened (there's a feature request you could submit if you were so inclined), but there's a few methods you could use. Two of which are shown below. ?php $foo = 'This seems to bark like a basset hound in PHP'; echo $foo{(strlen($foo) - 1)}; echo substr($foo,-1); ? -- /Daniel P. Brown Network Infrastructure Manager http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] slicing and dicing strings
Read http://php.net/manual/en/function.substr.php -Original Message- From: Kirk Bailey [mailto:kbai...@howlermonkey.net] Sent: Wednesday, June 27, 2012 6:15 PM To: php-general@lists.php.net Subject: [PHP] slicing and dicing strings ok, it slices and dices, but how? in python, to print all but the last char in string FOO, we say print FOO[:-1] But this seems to bark like a basset hound in php. Whyfore? Now tihs tyro is seeking sage words to help me understand this. RTFM is not sage words; if you don't want to help me please don't waste the bandwidth. Would anyone care to help me understand this without dedicating 4 precious and in over demand/under supply hours to RTFM? -- end Very Truly yours, - Kirk Bailey, Largo Florida kniht +-+ | BOX | +-+ think -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] slicing and dicing strings
On Wed, Jun 27, 2012 at 5:15 PM, Kirk Bailey kbai...@howlermonkey.net wrote: ok, it slices and dices, but how? in python, to print all but the last char in string FOO, we say print FOO[:-1] But this seems to bark like a basset hound in php. Whyfore? As said, PHP is not Python. Pretty much *nothing* else is Python. That said, the trope still has legs in PHP: From http://us2.php.net/manual/en/function.substr.php : If start is negative, the returned string will start at the start'th character from the end of string. Now tihs tyro is seeking sage words to help me understand this. RTFM is not sage words; if you don't want to help me please don't waste the bandwidth. RTFM with no hint of where to look is a problem. But the dictum of Read here in the manual will surely be the best thing. You will then know where to look for future questions. Would anyone care to help me understand this without dedicating 4 precious and in over demand/under supply hours to RTFM? You may not have 4 precious and overdemanded/undersupplied hours, but at some point everyone who can answer this has had to slog through the manual; we haven't just been lounging in our opulence pouring over the documentation out of some need to aleviate our boredom. Nor is anyone on this list to spend their time providing answers which *are* readily available with just a bit of google-fu. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] slicing and dicing strings
Stuart Dallas stu...@3ft9.com wrote in message news:d889b8e1-2eab-4f36-83cb-8a52b5ec6...@3ft9.com... WARNING: May contain traces of sarcasm. If it would really take you 4 hours to find this out via the manual or Google then I think it would be 4 hours well spent: 3 hours 55 minutes learning how to use the manual / Google effectively, and 5 minutes to then get the answer you seek. -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/ hear hear! Or is it here here!? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php