|
Posted by Julien CROUZET on 10/14/70 11:39
julian_m avait énoncé :
> Julien CROUZET wrote:
>
>> The probleme is here if : (strpos($buffer, '<?') === true){
>>
>> strpos returns the position of the first occurence of your searched
>> string or FALSE if it doesn't find it.
>>
>> The operator === is a STRICT comparison, that means that it'll be true
>> if the operands are EXACTLY the same.
>>
>> As your strpos finds a '<?', it returns its position in your file,
>> (ie: 45), and 45 is not EXACTLY true.
>>
>> You have to change
>> strpos($buffer, '<?') === true){
>> for
>> strpos($buffer, '<?') !== false){
>>
>
> two things:
> 1st: You're faster than the light! Your advice works nice. Thanks!
>
> 2nd: What would be EXACTLY true? 1?
>
Only true is EXACTLY true.
For example, is_array($_POST) will be EXACTLY true, as it returns true.
The reason for such a strict comparison is that strpos returns the
index of the found substring, so if your string starts with '<?',
strpos will return 0 (position 0).
In a large comparison, (0 == false), but in a STRICT one, (0 !==
FALSE).
if (strpos($buffer, '<?') !== FALSE)
means if we find '<php'
if (strpos($buffer, '<?') != FALSE)
means if we find '<?php', after the first character of buffer
--
Julien CROUZET - DSI Theoconcept
julien.crouzet@/enlever ca\theoconcept.com
http://www.theoconcept.com
[Back to original message]
|