--TEST-- Test strrpos() function : usage variations - unexpected inputs for 'needle' argument --FILE-- 'red', 'item' => 'pen'), // boolean values true, false, TRUE, FALSE, // objects new sample(), // empty string "", '', // null values NULL, null, // resource $file_handle, // undefined variable @$undefined_var, // unset variable @$unset_var ); // loop through each element of the 'needle' array to check the working of strrpos() $counter = 1; for($index = 0; $index < count($needles); $index ++) { echo "-- Iteration $counter --\n"; var_dump( strrpos($haystack, $needles[$index]) ); $counter ++; } fclose($file_handle); //closing the file handle echo "*** Done ***"; ?> --EXPECTF-- *** Testing strrpos() function with unexpected values for needle *** -- Iteration 1 -- Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 2 -- Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 3 -- Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 4 -- Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 5 -- Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 6 -- Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 7 -- Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 8 -- Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 9 -- Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 10 -- Warning: strrpos(): needle is not a string or an integer in %s on line %d bool(false) -- Iteration 11 -- Warning: strrpos(): needle is not a string or an integer in %s on line %d bool(false) -- Iteration 12 -- Warning: strrpos(): needle is not a string or an integer in %s on line %d bool(false) -- Iteration 13 -- Warning: strrpos(): needle is not a string or an integer in %s on line %d bool(false) -- Iteration 14 -- Warning: strrpos(): needle is not a string or an integer in %s on line %d bool(false) -- Iteration 15 -- Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 16 -- Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 17 -- Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 18 -- Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 19 -- Notice: Object of class sample could not be converted to int in %s on line %d Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 20 -- bool(false) -- Iteration 21 -- bool(false) -- Iteration 22 -- Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 23 -- Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 24 -- Warning: strrpos(): needle is not a string or an integer in %s on line %d bool(false) -- Iteration 25 -- Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 26 -- Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) *** Done ***