A PHP function to check if a given number, is a prime number
In this code snippet, we’ll show an example of how to check if a given number, is…
In this code snippet, we’ll show an example of how to check if a given number, is…
In this code snippet, we’ll show an example of how find the sum of two positive or negative…
In this code snippet, we’ll show an example to calculate the duration or distance between a two dates…
title tags tail array,beginner Returns all elements in an array except for the first one. Use array_slice() and count() to return…
title tags shorten string,beginner Returns a shortened string. Use mb_strlen(), mb_substr() and rtrim() to shorten a string to a give number of…
Groups a PHP array by some given function, in this case string length. title tags groupBy array,intermediate…
title tags decapitalize string,beginner Decapitalizes the first letter of a string. Decapitalizes the first letter of the…
A palindrome is a word, number or even a phrase, which is symmetrical, for example when you…
Generates an array, containing the Fibonacci sequence, up until the nth term. Create an empty array, initializing…
Compare two strings and returns true if both strings are anagram, false otherwise. title tags isAnagram string,beginner Use count_chars() to compare $string1 and $string2….