ss23 Posted April 19, 2007 Share Posted April 19, 2007 151: if (strpos($con['buffer']['text']), "timer") !== FALSE){ 152: cmd_send(prep_text("Time", date("F j, Y, g:i a", time()))); 153: 154: } the error is Parse error: Syntax error, unexpected ',' in C:\path...... on line 151 Link to comment https://forums.phpfreaks.com/topic/47720-php-strpos-error/ Share on other sites More sharing options...
bsprogs Posted April 19, 2007 Share Posted April 19, 2007 try this instead I moved the first ) from after ['text'] to the end of the strpos() function where it belongs. You needed to have the , "timer" inside the strpos function as it's required to be. if (strpos($con['buffer']['text'], "timer")) !== FALSE){ cmd_send(prep_text("Time", date("F j, Y, g:i a", time()))); } Please let me know if that worked Link to comment https://forums.phpfreaks.com/topic/47720-php-strpos-error/#findComment-233037 Share on other sites More sharing options...
ss23 Posted April 19, 2007 Author Share Posted April 19, 2007 unexpected T_IS_NOT_IDENTICAL. I think the bracket should be there as its ($con[d][d]). Thats the variable needed to compare. I think... Link to comment https://forums.phpfreaks.com/topic/47720-php-strpos-error/#findComment-233039 Share on other sites More sharing options...
bsprogs Posted April 19, 2007 Share Posted April 19, 2007 unexpected T_IS_NOT_IDENTICAL. I think the bracket should be there as its ($con[d][d]). Thats the variable needed to compare. I think... I've never seen that error before but here is the information on strpos() http://php.net/strpos int strpos ( string $haystack, mixed $needle [, int $offset] ) As you can see from that site, you need to have at least strpos($1, $2) within the quotes. The int $offset is optional but the others are required. Link to comment https://forums.phpfreaks.com/topic/47720-php-strpos-error/#findComment-233044 Share on other sites More sharing options...
ss23 Posted April 19, 2007 Author Share Posted April 19, 2007 i think i got it testing. it should be if (strpos("timer", $con['buffer']['text']) !== FALSE){ cmd_send(prep_text("Time", date("F j, Y, g:i a", time()))); } needle = time haystack = $con Link to comment https://forums.phpfreaks.com/topic/47720-php-strpos-error/#findComment-233051 Share on other sites More sharing options...
ss23 Posted April 19, 2007 Author Share Posted April 19, 2007 ffs now it only works if its just "timer" Link to comment https://forums.phpfreaks.com/topic/47720-php-strpos-error/#findComment-233054 Share on other sites More sharing options...
ss23 Posted April 19, 2007 Author Share Posted April 19, 2007 all working now needle and haystack round the wrong way Link to comment https://forums.phpfreaks.com/topic/47720-php-strpos-error/#findComment-233058 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.