Re: Unable to get strpos() to work correctly in class method - more.... SOLVED
| From: | Jonathan Eagle | Date: | Thu, 26 Feb 2015 20:23:04 +0000 |
| Subject: | Re: Unable to get strpos() to work correctly in class method - more.... SOLVED | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-324534@lists.php.net to get a copy of this message | ||
On 2/26/2015 2:22 PM, Christoph Becker wrote:
> 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.
>
Boy, do I feel stupid. This is almost as bad as the time I .... well,
never mind!
You are absolutely right. That is my problem, and was easily fixed with
html_entity_decode(). Thanks so much!!!