[Phpmyadmin-devel] (PMA_SQP_typeCheck) operator "===" and PHP 3
Rabus
rabus at bugfixes.info
Tue Feb 4 12:00:04 CET 2003
-----Original Message-----
From: Marc Delisle [mailto:DelislMa at CollegeSherbrooke.qc.ca]
>
> gettype( ) works on variables, but the case we have is:
> if(strpos($whatWeWant, $typeSeperator) === FALSE) {
>
> I don't know if it works on expressions and constants.
>
> Anyway, looking at the code, we usually workaround this
> strpos problem with the "append a blank" trick:
>
> if (strpos(' ' . $goto, 'tbl_properties') == 1) {
>
> Marc
>
Of course, it does. gettype() checks the type of the expression. A
variable is also an expression, just like a function call, a mathmatic
operation or whatever.
I'm taking your example and using my workaround:
if (strpos($whatWeWant, $typeSeperator) == FALSE &&
gettype(strpos($whatWeWant, $typeSeperator)) == gettype(FALSE)) {
Of course, we can make this a bit shorter:
$tmp = strpos($whatWeWant, $typeSeperator);
if (!$tmp && gettype($tmp) == 'boolean') {
But our usual workaround for the strpos problem is this one:
if (!strpos(' ' . $whatWeWant, $typeSeperator)) {
Your code above appears incorrect to me because we want to have the case
that the needle string does not appear in the haystack string, don't we?
So 1 is wrong, it has to be 0 or FALSE (doesn't matter since 0 == FALSE
:o) ).
Alexander M. Turek
<alex at bugfixes.info>
+-----------------------------+
| The phpMyAdmin Project |
| http://www.phpmyadmin.net |
| rabus at users.sourceforge.net |
+-----------------------------+
| [bugfixes.info] |
| http://www.bugfixes.info |
| rabus at bugfixes.info |
+-----------------------------+
More information about the Developers
mailing list