can't find " with strpos

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
psychotomus
Forum Contributor
Posts: 487
Joined: Fri Jul 11, 2003 1:59 am

can't find " with strpos

Post by psychotomus »

i can't seem to find " with strpos

if tried

Code: Select all

$temp = strpos($_POST['txtData'], "screen_path[" . $i . "] = \"");

Code: Select all

$temp = strpos($_POST['txtData'], 'screen_path[' . $i . '] = "');
and

Code: Select all

$temp = strpos($_POST['txtData'], "screen_path[" . $i . "] = " . chr(34));
any ideas?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

Code: Select all

$_POST['txtData'] = 'xyzscreen_path[1] = "abc"';
$i = 1;
$temp = strpos($_POST['txtData'], 'screen_path[' . $i . '] = "');
var_dump($temp);
prints int(3) as expected. The problem must be somewhere else.
Please try

Code: Select all

echo "_POST['txtData']: ", htmlentities($_POST['txtData']), "<br />\n";
echo 'needle: screen_path[' . $i . '] = "', "<br />\n";
$temp = strpos($_POST['txtData'], 'screen_path[' . $i . '] = "');
Post Reply