[pmwiki-devel] strange strpos problem...

Patrick R. Michaud pmichaud at pobox.com
Tue Apr 24 12:34:58 CDT 2007


On Tue, Apr 24, 2007 at 01:24:27PM -0400, The Editor wrote:
> I've been struggling with some complicated variable functions and have
> my head wrapped around a strange problem...
> 
> Given this function:
> 
> function ZAPMfunc($params) {
>   if (strpos($params, " ") !== false) {
>       return "yes";
>       }
>    else {
>       return "nope";
>       }
> ...
> 
> I've verified that $params is a string (using gettype) and that it's
> value has a space in the middle of it. I can return $params and it's
> exactly what it's supposed to be.
> 
> Yet this function no matter what returns "nope" instead of "yes".

There must be something else wrong with your code, as the above
works fine for me.  

    http://www.pmichaud.com/sandbox/zapmfunc.php

> I also tried
> 
> function ZAPMfunc($params) {
>    return substr($params, 1,2);
> 
> for example and it comes up blank.

Meaning it returns nothing, or it returns a blank, or ...?

Pm



More information about the pmwiki-devel mailing list