2 /* Prototype : int iconv_strpos(string haystack, string needle [, int offset [, string charset]])
3 * Description: Find position of first occurrence of a string within another
4 * Source code: ext/iconv/iconv.c
8 * Pass iconv_strpos different data types as $haystack arg to test behaviour
14 public function __toString() {
15 return "Class A object";
18 <<__EntryPoint
>> function main(): void
{
19 echo "*** Testing iconv_strpos() : usage variations ***\n";
21 // Initialise function arguments not being substituted
22 $needle = 'string_val';
32 // get a resource variable
33 $fp = fopen(__FILE__
, "r");
35 // unexpected values to be passed to $haystack argument
79 // loop through each element of $inputs to check the behavior of iconv_strpos()
81 foreach($inputs as $input) {
82 echo "\n-- Iteration $iterator --\n";
83 try { var_dump( iconv_strpos($input, $needle, $offset, $encoding)); } catch (Exception
$e) { echo "\n".'Warning: '.$e->getMessage().' in '.__FILE__
.' on line '.__LINE__
."\n"; }