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

Sarver Side Programing Files

The document provides instructions for setting up and running a basic PHP server on Apache to run PHP scripts locally, including installing Apache and PHP, starting the server, and accessing sample scripts through localhost. It then lists several basic algorithm problems to solve in PHP scripts, such as checking if a number is even or odd, converting between units like kilometers to miles, and evaluating variables.

Uploaded by

Rifat Rahman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
62 views

Sarver Side Programing Files

The document provides instructions for setting up and running a basic PHP server on Apache to run PHP scripts locally, including installing Apache and PHP, starting the server, and accessing sample scripts through localhost. It then lists several basic algorithm problems to solve in PHP scripts, such as checking if a number is even or odd, converting between units like kilometers to miles, and evaluating variables.

Uploaded by

Rifat Rahman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Practice

1) Check that you have PHP and Apache24 in your C drive.


2) Open your cmd.
3) cd to directory Apache24/bin
4) To install Apache, you type: httpd –k install
5) Then type: (make sure to close all the apps that use port 8080
such as vpn…)
httpd –k start
httpd –k restart
6) go to your browser and type: localhost:8080
7) If you see a long table of information, it means your server is
up running.
8) Now open the file:

C:/Apache24/htdocs/New Text Document.php

(use Aptana or notepad)


9) You can write your code in this file, then run the script by
going to your browser and typing: localhost:8080 , you will
see the results from your script there.
Today we are going to implement some basic
algorithms in PHP,

1)Write a PHP script to check if an integer is odd or even.

Answer:

<?php
$a=5;
if ($a%2==0)
{
echo “ This number is even”;
}
else
{
echo “ This number is odd”;
}
?>
2)Write a PHP script to Swap Two Variables3
3)Write a PHP script to Convert Kilometers to Miles
m=kilo * 0.621371
4)Write a PHP script to Check Vowel or consonant
5)Write a PHP script to Check Positive or Negative Using
if...else
6)Write a PHP script to initialize a variable and then
increment its value by 3.
7)Write a PHP program to check two given integers
whether either of them is in the range 100..200
inclusive. 
Sample Input:
100,199
250,300
105, 190
8)Write a PHP code for conversion from the Dollars-to-
Euros (Exchange rate 1 USD=0.8467 Euro).
9)Write a PHP script that accepts a temperature value in
Celsius (C) through a web form and converts it to the
Fahrenheit (F) scale. The conversion formula to use is:

F = (9/5) * C + 32.

You might also like