Re: Unable to get strpos() to work correctly in class method - more....

From: Date: Thu, 26 Feb 2015 19:22:47 +0000
Subject: Re: Unable to get strpos() to work correctly in class method - more....
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-324533@lists.php.net to get a copy of this message
JEofVA wrote: > I just noticed something weird in the debug information that I am > getting from this program that probably has something to do with my > problem, but I don't quite know what to make if it. Perhaps someone can > clue me into what is going on. > > When the 'extract_quotes($string)' method is called the $string it is > passed comes from another variable that holds the cleaned contents of a > text input. I didn't notice before but as I looked at the string using > var_dump(), immediately after it has gotten passed into the method, I > get an anomalous report. Below is what I get: > > string(57) ""some phrase" single "another phrase"" > > > The outermost quotes excluded, I count 37 characters in the string. Why > are 57 being reported? Could the miscount be an indicator of why the > method doesn't recognize any of the quotes? Well, if this var_dump() output is displayed on a webpage, you should have a look at the HTML source code. I can easily imagine that the string is actually: '"some phrase" single "another phrase"' This has a length of 57 bytes, and would explain why your method doesn't recognize the quotes. -- Christoph M. Becker

« previous php.general (#324533) next »