Question: Prompt: 1 . Write a PHP script to replace all occurrences of cat with dog in the string I love cats, but I also love
Prompt:
Write a PHP script to replace all occurrences of "cat" with "dog" in the string "I love cats, but I also love caterpillars."
Write a PHP script to escape a single quote in the string "It's a beautiful day!".
Write a PHP script to get the length of the string "This string has characters.".
Write a PHP script to get a substring of the string "The quick brown fox jumps over the lazy dog." that starts with the word "lazy".
Write a PHP script to get the position of the word "lazy" in the string "The quick brown fox jumps over the lazy dog.".
Create a PHP script to print the current date in the format of YYYYMMDD
Create a PHP script to print the current date and time in the format of YYYYMMDD HH:MM:SS
Create a PHP script to print the current month and year in the format of "Month Year" eg February
Create a PHP script to add a certain number of days to a given date. The date and number of days can be input by the user in the format of YYYYMMDD and an integer respectively. The output should be in the same format as the input.
Create a PHP script to print the difference between two dates in the format of X years, Y months, Z days". The dates can be input by the user in the format of YYYYMMDD
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
