function_in_php
function_in_php
1. Write a function in PHP that takes two numbers as parameters and returns their sum.
8. Create a function that takes an array and returns the sum of its elements.
---
*Intermediate Level*
12. Write a function to calculate the greatest common divisor (GCD) of two numbers.
14. Write a function that takes a string and returns the number of words in it.
16. Write a function that swaps two variables without using a third variable.
17. Write a function that takes a date string in YYYY-MM-DD format and returns the day of the week.
18. Create a function that finds the second largest number in an array.
---
*Advanced Level*
21. Create a function that generates a random password with a given length.
22. Write a function that calculates the power of a number without using pow().
23. Implement a function that validates an email address format.
28. Create a function that sanitizes user input to prevent XSS attacks.
29. Write a function to get the current memory usage of the PHP script.
30. Implement a function that measures the execution time of another function.