0% found this document useful (0 votes)
2 views

function_in_php

The document outlines a series of programming tasks in PHP, categorized into Basic, Intermediate, and Advanced levels. Each level contains specific functions to be implemented, such as calculating sums, checking for prime numbers, and generating random passwords. The tasks cover a range of programming concepts and skills, from simple arithmetic to more complex algorithms and data validation.

Uploaded by

bejpapai
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

function_in_php

The document outlines a series of programming tasks in PHP, categorized into Basic, Intermediate, and Advanced levels. Each level contains specific functions to be implemented, such as calculating sums, checking for prime numbers, and generating random passwords. The tasks cover a range of programming concepts and skills, from simple arithmetic to more complex algorithms and data validation.

Uploaded by

bejpapai
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

*Basic Level*

1. Write a function in PHP that takes two numbers as parameters and returns their sum.

2. Write a function that prints "Hello, World!" when called.

3. Write a function to check if a given number is even or odd.

4. Create a function that returns the factorial of a given number.

5. Write a function to find the maximum of three numbers.

6. Create a function that reverses a string.

7. Write a function to check if a given string is a palindrome.

8. Create a function that takes an array and returns the sum of its elements.

9. Write a function to count the number of vowels in a given string.

10. Write a function that converts a string to uppercase.

---

*Intermediate Level*

11. Create a function that generates the Fibonacci series up to n terms.

12. Write a function to calculate the greatest common divisor (GCD) of two numbers.

13. Create a function to remove duplicate values from an array.

14. Write a function that takes a string and returns the number of words in it.

15. Create a function to check whether a number is prime or not.

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.

19. Write a function that converts a temperature from Celsius to Fahrenheit.

20. Create a recursive function to calculate the sum of digits of a number.

---

*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.

24. Write a function to sort an associative array by values in ascending order.

25. Create a function that checks if a given year is a leap year.

26. Implement a function to generate a unique identifier (UUID).

27. Write a function to check if two strings are anagrams.

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.

You might also like