Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4,6 TrustPilot
logo-home
Document preview thumbnail
Preview 2 out of 7 pages
Summary

Summary ICT3612 ( Advanced Internet Programming)

Document preview thumbnail
Preview 2 out of 7 pages

The purpose of this document is to provide assistance and guidance in completing Assignment Two (3612).

Content preview

This document serves as a guideline for Assignment Two (3612) and provides detailed explanations.
Please note that by providing this disclosure, I, acknowledge that I am not liable for any marks
awarded to you or any copyright claims resulting from the use of this guideline.

Disclaimer:

While every effort has been made to ensure the accuracy and reliability of the information provided
in this guideline. It is your responsibility to critically evaluate and adapt the information to meet the
specific requirements of your assignment.




QUESTION 1



<?php

//WRITE THE FUNCTION BELOW AS PER THE QUESTION. NO CODE TO INVOKE THE FUNCTION
SHOULD BE INCLUDED HERE

//NO HTML ALLOWED. ONLY PHP CODE IS ALLOWED

function findLongestString(...$strings) {

$maxLength = 0; // Variable to store the length of the longest string



foreach ($strings as $str) {

if (is_string($str)) { // Check if the argument is a string

$length = strlen($str); // Get the length of the string



if ($length > $maxLength) { // Update maxLength if the current string is longer

$maxLength = $length;

}

}

}



return $maxLength;

}



// Test the function

, $strings = array("Test", 123456, "On");

$longestLength = findLongestString(...$strings);

echo $longestLength; // Output: 4



?>



QUESTION 2



<?php

//WRITE THE FUNCTION, INVOKE THE FUNCTION, DISPLAY RESULT BELOW AS PER THE QUESTION.

//NO HTML ALLOWED. ONLY PHP CODE IS ALLOWED



$generateRandomNumbers = function($start, $end, $count) {

$numberRange = range($start, $end); // Create an array of numbers within the range

shuffle($numberRange); // Shuffle the array randomly

return array_slice($numberRange, 0, $count); // Return the desired number of random numbers

};



$randomNums = $generateRandomNumbers(1, 50, 6);

foreach ($randomNums as $num) {

echo $num . " "; // Output each random number separated by a space

}




?>




QUESTION 3



<?php

Document information

Uploaded on
June 19, 2023
Number of pages
7
Written in
2022/2023
Type
Summary
R200,00

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
phegelelo
5,0
(1)
Sold
17
Followers
15
Items
12
Last sold
2 year ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their exams and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can immediately select a different document that better matches what you need.

Pay how you prefer, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card or EFT and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions