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:
1. Write a PHP script to replace all occurrences of "cat" with "dog" in the string "I love cats, but I also love caterpillars."
2. Write a PHP script to escape a single quote in the string "It's a beautiful day!".
3. Write a PHP script to get the length of the string "This string has 32 characters.".
4. 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".
5. Write a PHP script to get the position of the word "lazy" in the string "The quick brown fox jumps over the lazy dog.".
6. Create a PHP script to print the current date in the format of "YYYY-MM-DD".
7. Create a PHP script to print the current date and time in the format of "YYYY-MM-DD HH:MM:SS".
8. Create a PHP script to print the current month and year in the format of "Month Year" (e.g. February 2023).
9. 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 "YYYY-MM-DD" and an integer respectively. The output should be in the same format as the input.
10. 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 "YYYY-MM-DD".

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!