Random time from timestamp string with PHP
How to generate a random time from an H:i:s formatted timestamp with PHP. For this example 02:38:55 will be used which represents 2 hours, 38 minutes and 55 seconds. The…
PHP backend web language
How to generate a random time from an H:i:s formatted timestamp with PHP. For this example 02:38:55 will be used which represents 2 hours, 38 minutes and 55 seconds. The…
A simple PHP function to convert and format Bytes to Megabytes, Gigabytes and Terabytes: function convertBytes(int $bytes, string $convert_to = ‘KB’, bool $format = true, int $decimals = 2): float…
How to make a simple Leaflet map box with a marker at your set latitude and longitude values. Leaflet is a free, open-source javascript library for working with interactive maps….
PHP __DIR__ returns the current working directory, its usage is common when including files as you don’t have to dynamically define the directory each time. Simply running echo __DIR__; Will…
How to make a Bootstrap toggle button with a status update by using PHP, Ajax and MySQL. The toggle button represents on/off which is 1 and 0 in the database….
Removing duplicate values from an array in PHP by using array_unique(), this will return a new array, based on the input without duplicate values. The second parameter is sort type,…
Check if a process is running on a Linux system such as Ubuntu by using PHP. This is done by using pgrep and checking if its response is empty. pgrep…
A simple system that automatically refreshes an expired OAuth access token if a call is attempted but the token is expired. This post is a continuation of Twitch authentication with…
From May 11th 2020 Twitch has implemented OAuth to its helix API version, now instead of just needing the client id key to make API calls you also need to…
Getting a file’s modified time with PHP is done by using the filemtime() function, this returns the files last modified time in Unix format. An example below which also checks…