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

I need help in a website updates, I need help in a Website Updates I do ...

I need help in a Website Updates I do like the make the subsequent changes to my website: 1 Add tag line beneath logo to home page 2 Add about section to right of home page w

Fashion luxury brand website design and development, Fashion Luxury Brand W...

Fashion Luxury Brand Website Design and Development I want someone to design and implement a website for a high end luxury fashion label that I am launching which at the moment

Design a website in wordpress using custom css, I have a WordPress website ...

I have a WordPress website that is about 95 percent done. It was done using a template that I did a LOT of custom CSS with. I am having some issues with a couple of CSS items and I

Clear sky media llc is in search of web developers, Clear Sky Media LLC ...

Clear Sky Media LLC Clear Sky Media LLC is in search of 10 Web Developers or 10 Companies to become a partner with us in the US. We will take care of marketing as well as sales.

Need help to make api changes, Need help to make API changes a) All work...

Need help to make API changes a) All work submitted via github b) All time billed using workview Want adjustments to custom scripts for ebay APIs: a) Download part numb

I desire php help for bilingual website, I desire PHP help for BILINGUAL WE...

I desire PHP help for BILINGUAL WEBSITE We are in desire of a bilingual website that will have an online store and information about the designer of the product. Our product is

We need help to import bulk products and images, We need help to Import bul...

We need help to Import bulk products and images to prestashop with combinations We need to bulk import the products as well as images with combinations to our prestashop store.

Create the website home page, For storing pages now that a site structure i...

For storing pages now that a site structure is set up & assets for the Compass site, you'll develop the first page-a home page for the site. As you develop this page, you'll insert

Unordered lists, First one, we will create an unordered list. These lists a...

First one, we will create an unordered list. These lists are also called as bulleted lists. These lists are characterized through list items that do not have numbers. They are used

I need help in basic wordpress formatting, I need help in Basic Wordpress F...

I need help in Basic Wordpress Formatting Repeat the process of- 1) Adding a specific short code to over 100 pages, while matching the shortcode a predefined category of uploade

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