Jump to content

Tutorial example produced unexpected results


Recommended Posts

https://www.w3schools.com/php/phptryit.asp?filename=tryphp_filter_adv3 is a tutorial example.  It attempts to validate what appears to be a valid URL but claims it is not.

I see this forum gets little use, so has the language changed since the example was created, is there a mistake in the example, or is the problem on my end in the browser?

I am using the latest FireFox browser under Windows 10.

Link to post
Share on other sites

There's nothing odd with this one. You're missing the fact that the program checks for two things

  • Valid URL (FILTER_VALIDATE_URL)
  • Has a query string (FILTER_FLAG_QUERY_REQUIRED)

"https://www.w3schools.com" is a valid URL, but lacks a query string and therefore does not succeed the check.

Edited by Funce
PHP Flags
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...