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
Summary

Summary ICT3612 ( Advanced Internet Programming)

Rating
-
Sold
1
Pages
7
Uploaded on
19-06-2023
Written in
2022/2023

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

Institution
Course

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

Written for

Institution
Course

Document information

Uploaded on
June 19, 2023
Number of pages
7
Written in
2022/2023
Type
SUMMARY

Subjects

$12.52
Get access to the full document:

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

Get to know the seller

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 University of South Africa (Unisa)
Follow You need to be logged in order to follow users or courses
Sold
17
Member since
4 year
Number of followers
15
Documents
12
Last sold
1 year ago

5.0

1 reviews

5
1
4
0
3
0
2
0
1
0

Why students choose Stuvia

Created by fellow students, verified by reviews

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

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card 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