Differences between include(), require() and include_once(), PHP Web Programming


(a) What are the differences between include(), require() and include_once()?

(b) Convert the below if-elseif code to its equivalent switch case version:

$day = 'Wednesday';
if ($day == 'Monday') {
echo 'Wish you a fresh start!';
elseif ($day == 'Wednesday') {
echo 'Keep going. Good luck!';
elseif ($day == 'Friday') {
echo 'Happy weekend!';
else {
echo 'Good day!';

(c) Describe the two kinds of arrays supported by PHP and provide suitable code fragments to illustrate your answer?

(d) Write a function that returns the result of a basic arithmetic operation like addition, subtraction, multiplication and division based on two supplied operands passed as arguments. The function should accept two mandatory arguments, i.e. the first and second operands and a third optional argument for the operator (default operator value is addition).

(e) Consider the following PHP code:

for ($i=1; $i<=3; $i++)
for ($j=1; $j<=$i; $j++)
echo 'X';
echo '

The above code fragment uses a for loop construct to print out Output A. Using the While construct, rewrite the above code fragment to print out the same output.

Posted Date: 12/4/2013 5:10:44 AM | Location : United States

Related Discussions:- Differences between include(), require() and include_once(), Assignment Help, Ask Question on Differences between include(), require() and include_once(), Get Answer, Expert's Help, Differences between include(), require() and include_once() Discussions

Write discussion on Differences between include(), require() and include_once()
Your posts are moderated
Related Questions
This is part of a Window object & it is accessed by the window. location property. It has the complete URL of any given Window object, or, if none is denoted, of current Window obj

We need a Analyst Programmer Our Esteemed as well as Reputable Client is looking for an Analyst Programmer (Python) for their organization. The candidate is mandatory to perform

We need help to develop a Price Comparison Website I need to start a new website which compares prices of different products among different categories available on different ec

BigCommerce entirely responsive design application I am in search of a programmer who can implement my Mockups on my BigCommerce shop. Requirement a) You write clean code wit

Physical layer : This is concerned with sending raw bits among the source & destination nodes over a physical medium. The source & destination nodes need to agree on a number of fa

A function is a deferred script since it does not do anything till a function, an event, a JavaScript link, or an immediate script calls it. You have possibly noticed that you can

Create a shopping cart I have an incomplete shopping cart. The preceding expert didn't finish the project. He has done 70% of the work as well as then sent it to me. I would lik

Question: (a) (i) How does HTML allow you to insert an image on a page with an alternate text if the image is not loaded? (ii) If after uploading your site, all the images

We want a Web Development Mentor I am seeking a tutor for web development. Seeking someone to meet three times a week for 60 minutes for a 1 to 2 month mentorship. The meetings

After that you will adjust the space within the navigation button table. The simplest way to choose a table in Standard view is using the tag selector that displays HTML tags of el