I noticed at StackOverFlow they used strpos and stripos. Frankly, donât know what the latter is but seems the same as the former. Have to check it out.
I know what you mean. It wonât look for exact match but fuzzy.
Meaning, if I want to match âassâ then it will find matches in these:
assassin
pass
passover
pass over
Seems like both are the same. Only difference is one ignores the case and the other does not.
Seems like latter better than former. However, still does not look perfect.
Well, then they are not the same if youâve found a difference, are they? Sometimes you want to search case-sensitive, sometimes you donât. So thereâs a function for each because it saves you folding the haystack and needle to uppercase or lowercase yourself.
Right-click and view source, is there anything there? Itâs not something basic like running them from Windows Explorer rather than via the server? If you add an echo at the start of the php that isnât inside a conditional, does that display?
Even bearing in mind what you said, I still stick to my belief that:
âSeems like both are the same. Only difference is one ignores the case and the other does not.â
My statement is not untrue is it ? I said they âseem the sameâ and not âthey are the sameâ. And something that seems or looks or feels the same but is not is âsimilarâ. Similar but not the same.
The 2 concerned functions are similar. Not same.
And, I already figured-out why and where both differ. It is as you said, they save us a lot of time when in one hand dealing with case sensitive issue and on the other hand dealing with non-case sensitive issue.
For some reason the blank pages I see no more but the echos today. And this only after I had to refresh chrome about 10 times nearly each time of updating the scripts! Maybe a chrome bug.
I was gonna upload a clip for you guys to view how many times I have to click the refresh button for chrome to show the updates. No wonder I was seeing blank pages yesterday!
Mmm. I am now suspecting that a lot of problems I encounter is not due to my code writing but due to chrome messing about! Have to use fire fox on the side from now.
I thought it generally checks the whole array rather than get the script to loop and check each array item one by one for matches.
Similar question goes for this one too:
<?php
//script 6: https://stackoverflow.com/questions/32522192/check-if-an-array-element-is-in-a-string
//$email = $_POST['email'];
$email = "evil@devil.com";
if(preg_match("/\b(evil|devil)\b/", $email)){
echo "Script 6 - Found Banned Word: HOW DO I DISPLAY THE FOUND BANNED WORD HERE ? WOULD LIKE TO SEE SNIPPET EXAMPLE";
}
?>
May I suggest that once you manage to create some script that does a unique task then create a function in a functionslibrary.php. Error_reporting and ini_set display_errors could also be part of the library.
I already did that. That way, my many paged scripts did not have the error codes repeated on every page. But when I copy paste each of my scripts/pages codes to this forum then you guys complain where my error reporting codes are. hence, I added them on every page now. I will take them out once the project comes to an end (edited and final version). So, donât worry.
As of now, the error reporting codes would stay on every page so when I copy-paste their codes to this forum then others (who donât know any of this) donât start screaming why the error reporting codes arenât present on the script/page. Understand ?
Now, how-about I start getting answers on my previous post ?
Look what my config.php looks like. It is part of my member registration-login script (check my thread on it):
<?php
/*
ERROR HANDLING
*/
declare(strict_types=1);
ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');
error_reporting(E_ALL);
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
// session start
if(!session_start()) {
session_start();
}
// include files
include 'conn.php';
include 'site_details.php';
// include functions
include 'functions.php';
?>