Question: I've just started learning php and I have to solve the practice questions in the text book! Practice questions: I need to make a function

I've just started learning php and I have to solve the practice questions in the text book!

Practice questions:

  • I need to make a function that uses pi () value as a global variable in my program to print the area of the circle. And then I need to make a form to input the radius from the user and display the area to the user.

  • Input a string of size divisible by 2 from the user. Then I need to make a function to convert this string into an associative array, where every odd character in the string is a key and the even character is its corresponding value.

  • I need to make a form in HTML that lets the user upload a file. So I need a PHP script to open the text file and print all the data in it.

  • I need to make a program to use session variables and start a session. In this part, I have to use $_SESSION['views'] to count page views. The question says the number should increment each time the user reloads/reopens the page.

  • I need to make a function that takes 1 float number, multiplies it by 9 and returns an integer value to the caller. By using the default value for the function argument as 5.2.

  • I need to explain the difference between local and global variables in PHP. For this question, I need to explain it with an example!

  • I need to explain why is PHP considered a loosely typed language.

  • I need to explain what are type declarations in PHP and how they are useful with an example.

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 Programming Questions!