troubleshooting Question

Assignment: write a new function in JQuery or PHP

Avatar of Eric Bourland
Eric BourlandFlag for United States of America asked on
PHPJavaScript
15 Comments3 Solutions290 ViewsLast Modified:
I have an assignment in JQuery and PHP and I do not even know how to begin, since I have some acquaintance with, but insufficient experience in, both languages. My assignment is:

Write a new function hardwickday(){ } that takes a nested array of mixed values as its argument (assume that the variable is only nested two levels deep -- an array of arrays).

The output of this function should consist of one line for each of the nested arrays; within each line, the items in each array should be joined together into a long string, with each item separated by the the following string "\n\". Both the root-level array and the nested arrays may be of arbitrary length.

The following input and output should help clarify this function:

INPUT
$myvar = array(
array(7, 'apple', 'fridge'),
array('monkey', 'banana', 3, 5, 9),
array('abcdefghijk')
...etc...
);

OUTPUT (on three lines)
7\n\apple\n\fridge
monkey\n\banana\n\3\n\5\n\9
abcdefghijk

I am supposed to write this function in either JQuery or PHP. Which should I choose -- which is appropriate? I understand the definitions of / concepts of: array, function, and string. But I do not know how to begin this task. Thank you for any ideas.

Eric B
ASKER CERTIFIED SOLUTION
Proculopsis

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 3 Answers and 15 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 15 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros