Try out PHP code and functions online in test windows

Try out PHP functions with the w3schools test window

Ok, the headline sounds a bit strange, because PHP code mostly runs online when you don't have your own MAMP server running. Nevertheless, the title hits the nail on the head, because what I discovered today is a small test window in the browser with which you can quickly try out PHP code and its output without any files (I just say "test.php"! ) to have to write.

Service from w3schools.com

I found them practical test page on a server of the w3schools.com, which, by the way, is a great place to go if you want to learn PHP, MySQL, CSS, HTML, JavaScript, Python or one of the many other programming languages ​​offered on the website. Each area has lots of exercises, code examples, and even a quiz here and there to test your newfound knowledge.

Online test window for PHP

But what was decisive for this article is a nice tool that you can use find can. There, for example, code examples for PHP functions can be called up, which can even be changed live.

In the test window you can see the PHP code on the left. Then you click on RUN at the top and you have the output on the right.

In the test window you can see the PHP code on the left. Then you click on RUN at the top and you have the output on the right.

In the left text window you can see the code and on the right the output. This always changes when you click on the green "Run" button above.

With this I tried out which characters are filtered out of the string by the PHP function FILTER_SANITIZE_STRING. As it turned out, the function is perfect for cleaning data from form fields in order to remove possible malicious code.

Try it Yourself - practical examples for all PHP functions

I have to say that I really like the w3schools site. You not only get explanations of functions, as is also the case with many other PHP information portals, but you can also try out many things by using the "Try it Yourself" button. Here, for example, the button is placed in the PHP command strpos (). Clicking on it opens the sample code in a text window, which you can use to test the code directly.

With the try-it-yourself function, PHP commands can be easily fed and changed with your own content.

With the try-it-yourself function, PHP commands can be easily fed and changed with your own content.

In this way you can try out the code examples a bit and also incorporate your own data to see what the programming does with them.

-

Did you like the article and did the instructions on the blog help you? Then I would be happy if you the blog via a Steady Membership or at Patreon would support.

3 comments

  1. Uwe says:

    Cool, thanks for the info.
    I'm still looking for some kind of translator for php5 code to php 7. Is there such a thing?

  2. Uwe says:

    Thank you :-)

Leave a Comment

Your e-mail address will not be published.