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
The question is : where is the location of the source data?
it's generated by some user, extracted from some file or resource?
Depending on how to obtain the source data you'll be more clear about
what approach is the best for you (if the data is in a Javascript array you should use a javascript function)
Open in new window