Php 即使在使用html_entity_decode时,STRPO也会返回false和html实体

Php 即使在使用html_entity_decode时,STRPO也会返回false和html实体,php,html-entities,strpos,Php,Html Entities,Strpos,我试图在字符串中搜索一个子字符串,该字符串可能包含也可能不包含html实体,例如,但即使使用html_entity_decode(),它仍然返回false $str='online shop'; echo html_entity_decode($str); //outputs: online shop var_dump(strpos(html_entity_decode($str),'online shop')); //outputs: bool(false) !==空格(2

我试图在字符串中搜索一个子字符串,该字符串可能包含也可能不包含html实体,例如,但即使使用html_entity_decode(),它仍然返回false

$str='online shop';
echo html_entity_decode($str);
//outputs: online shop
var_dump(strpos(html_entity_decode($str),'online shop'));
//outputs: bool(false)

!==<代码>空格(20),解码时它实际上等于2字节的无中断空格
c2a0

U+00A0 |\xc2\xa0 |和#xa0;|无中断空间

您可以使用以下方法对此进行测试:

<?php
//
$str='&nbsp;';
var_dump(html_entity_decode($str));

!=<代码>空格(20)
,解码时它实际上等于2字节的无中断空格
c2a0

U+00A0 |\xc2\xa0 |和#xa0;|无中断空间

您可以使用以下方法对此进行测试:

<?php
//
$str='&nbsp;';
var_dump(html_entity_decode($str));

我不明白你想要什么输出。你能详细说明一下吗?我不明白你想要什么。你能详细说明一下吗?