Convert and format Bytes PHP function
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…
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,…
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…
Creating a PHP file by using PHP, the concept is the same as creating a text file except you have to enclose the code you want to be in your…
A PHP if, else if vs case switch vs nested if speed test comparison from Jeff-Russ found here. The test is a loop that calculates with a high number (500,000)…