PHP Snippets

Effective URL validation in PHP with regex

URL validation is a hard thing to do. There are so many variations that it is nearly impossible to predict…

Sending Axios parameters with a POST request in PHP

Using a library like Axios to create complex AJAX requests is simple and easy. Of course, we can use `fetch`…

Split PHP array in X equal number of elements

In PHP you can divide an array into an unknown number of chunks by specifying the number of elements in…