Question: PHP Write a function on PHP countdownFront($str, $num) that returns a string made of the first $num characters of the string followed by the first
PHP
Write a function on PHP countdownFront($str, $num) that returns a string made of the first $num characters of the string followed by the first $num-1 characters, followed by the first $num-2 characters, and so on. For example, countdownFront("Pancakes", 5) would return the string "PancaPancPanPaP".
Write a function on PHP longestRun($str) that takes a string as a parameter and returns the length of the longest sequence of the same character in the string. For example, longestRun("abc") should return 1, where longestRun("abbcddde") would return 3 because there are 3 ds in a row.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
