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…
title tags countVowels string,regexp,beginner Returns number of vowels in the provided string. Use a regular expression to…
title tags curry function,advanced Curries a function to take arguments in multiple calls. If the number of…
title tags drop array,beginner Returns a new array with $n elements removed from the left. Use array_slice() to remove $n elements from the…
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…