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

Draw layer from common toolbar, Step 1:  Select Layer from Common toolbar &...

Step 1:  Select Layer from Common toolbar & draw a layer. Step 2:  Write the text within the Layer. Step 3:  Click on Modify button (when the layer is selected) Step 4:  C

Seeking for a programmer ajax, Seeking for a programmer We look forward ...

Seeking for a programmer We look forward to build a relationship with somebody or a group of people to work with us on our e-commerce platform. Expertise needed- • JavaScr

Abstract class and its behavior, What is abstract class and explain its beh...

What is abstract class and explain its behaviour? Abstract class is declared as a solitary entity, so other classes may be inherited from it. An abstract  class can’t be instant

Need help to transfer prestashop site to live domain, Transfer prestashop s...

Transfer prestashop site to live domain I want a great programmer to transfer prestashop site to live domain prestashop experience in is required. Desired Skills are MySQL Ad

We need help in financial application support, We need help in Financial Ap...

We need help in Financial Application Support Enhance our account aggregation process using Yodlee API. We want to fix several bugs in our existing process as well as change fro

Need help in coldfusion api creation, Need help in ColdFusion API Creation ...

Need help in ColdFusion API Creation Our software product that is build in ColdFusion we need to create an API for it. Is this somewhat that you have experiences in? Desired

Market value targeted to regions or countries, A website that permits you t...

A website that permits you to enter data for a specific product make and model and perform a search on multiple websites, of any kind to generate a report of the different prices,

We want an experienced programmer to write a script, Web programmer We w...

Web programmer We want to allow logging on an S3 bucket to audit potential high usage from single users (example single IP addresses) on our Wordpress membership site. We wan

Javascript, in javascript i want to perform a mobile number length validati...

in javascript i want to perform a mobile number length validation in forms.. what can i do...

Body tag, If you have a head, you required a body. All of the content to be...

If you have a head, you required a body. All of the content to be displayed on the web page needs to be written within the body tag.  So whether text, textbox, headlines, checkbox

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