Question: Al You are given the following PHP script Al.php. Line File: Al.php 1 . 2. 3. 12. The PHP script A1.php should produce the following

Al You are given the following PHP script Al.php. Line File: Al.php 1 . 2. 3. 12. The PHP script A1.php should produce the following execution output: Original string: abcd Shifted by 1 characters: bcda Shifted by 2 characters: cdab Shifted by 3 characters: dabc Shifted by 4 characters: abcd Shifted by 5 characters: bcda (a) Implement the function shift_left which returns a string by shifting the characters in a given string $s to the left by $num characters. Thus, the function call shift_left("abcd", 1) should return a string "bcda". Hint : the PHP function substr can return a portion of a given string. [5 marks] (b) Write a for-loop to display the required execution output by calling the implemented function shift_left. [5 marks]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
