Techiio-author
Started by Bell GrantNov 7, 2021

Open
PHP compare values with HTML special characters

3 VIEWES 0 LIKES 0 DISLIKES SHARE
0 LIKES 0 DISLIKES 3 VIEWES SHARE

I am trying to compare rows from 2 PHP arrays like this...

if ($row1[$i] == $row2[$i]) {
    echo 'Rows match';
} else {
    echo 'Rows do not match';
}

This is working effectively till it comes throughout something that is encoded, so the apostrophe is a superb example. So the beneath 2 aren't the same...

This is an apostrophe'
This is an apostrophe'

I've tried the use of htmlspecialchars_decode to attempt to convert them earlier than evaluating but this isn't working. How can I compare those 2 rows?

1 Replies

Techiio-commentatorUtsab Das replied 15 days ago0 likes0 dislikes

Try html_entity_decode() with ENT_QUOTES flag

please go through with the below url:-

https://www.php.net/manual/en/function.html-entity-decode.php

html_entity_decode('This is an apostrophe'', ENT_QUOTES);

You must be Logged in to reply
Techiio-logo

Techiio is on the journey to build an ocean of technical knowledge, scouring the emerging stars in process and proffering them to the corporate world.

Follow us on:

Subscribe to get latest updates

You can unsubscribe anytime from getting updates from us
Developed and maintained by Wikiance
Developed and maintained by Wikiance