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

Assignment Help:

Question:

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


Related Discussions:- Differences between include(), require() and include_once()

Need help in php mysql connection, PHP MySQL connection (Digital Ocean) ...

PHP MySQL connection (Digital Ocean) I devour a server in Digital Ocean cloud with fresh install of Apache, MySQL 5.6, PHP 5.3, Centos 6.4 (64 bit). Want to setup MySQL Workbenc

I neeed help in cakephp project, I neeed help in CakePHP Project Good kn...

I neeed help in CakePHP Project Good knowledge of PHP. 1) Hands-on PHP based framework, Cake PHP 2) Demonstrable knowledge of web technologies including HTML, CSS, Javascript, A

Web site on cake php to be redesigned, Web Site on Cake PHP to be redesigne...

Web Site on Cake PHP to be redesigned and Things to be added Project Description: We have a web site that has some finishing off and also fixing some bugs. We will consider I

Need developer for scientific experiment, Scientific Experiment This is ...

Scientific Experiment This is a small project for a scientific experiment connected to a fashion startup. What is required- A Website that describes a promotion campaign f

Html5 based txt/csv data file charter, HTML5 Based TXT/CSV Data File Charte...

HTML5 Based TXT/CSV Data File Charter In search of a web developer to create a HTML5/JavaScript based web application to import tab delimited or comma separated information from

Need small five page website in wordpress, Small five page website in wordp...

Small five page website in wordpress (PSD I will supply of each page) I want to develop a small website in wordpress with required these tasks. I will source all pages design in

We need a google maps drawing polygon, We need a Google Maps Drawing Polygo...

We need a Google Maps Drawing Polygon as well as Output Zipcodes expert Create a Google Map permitting the user to draw a rectangle and on completion of the drawing, output the

Transport layer of osi model, Transport layer is the first end-to-end layer...

Transport layer is the first end-to-end layer. Header of the transport layer has information which helps send the message to the corresponding layer at the destination node. The me

We need a php developer for website, SanaSana Website Ecommerce website ...

SanaSana Website Ecommerce website using MySQL, Magento, PHP. There is several customization required for themes. Data has by now been procured. Desired Skills are MySQL Admi

We need a developer for bootstrap also php smart mind, We need a Developer ...

We need a Developer for bootstrap also php smart mind I want to make changes and minor modifications to a project done in bootstrap and php smart mind Desired Skills are MySQ

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd