-3

I am trying to use string function but these functions are not working in my program.

I am using following function.

echo strpos("set","namesetname");
echo strstr("set","namesetname");
echo stristr("set","namesetname");
echo strchr("set","namesetname");

all these functions are not displaying any things, nothing is returns or displayed on screen.

4

2 回答 2

1

strpos、strstr、strstr 和 strchr

您使用了错误的语法。更改参数位置反转

echo strpos("namesetname", "set");
echo strstr("namesetname", "set");
echo stristr("namesetname", "set");
echo strchr("namesetname", "set");

strpos

strpos返回BOOLEAN或位置。

于 2013-08-26T07:16:27.883 回答
0

使用以下功能将解决您的问题..

echo strpos("namesetname","set");
echo strstr("namesetname","set");
echo stristr("namesetname","set");
echo strchr("namesetname","set");

以下是一些链接供您参考

http://php.net/manual/en/function.strpos.php
http://php.net/manual/en/function.strstr.php
http://in2.php.net/manual/en/function。 stristr.php
http://php.net/manual/en/function.strchr.php

于 2013-08-26T07:19:48.093 回答