php - How to get the array values which the array created in function? -
When I think about the function of the array and I tried to create an array and in the form of a store clock in the function Works but how can the array value get out of the function?
function theClock ($ a, $ b, $ c) {$ time ['hour'] = $ a; $ Time ['min'] = $ b; $ Time ['seconds'] = $ c; Return time; } // How can I call the values of that array that is stored at $ time?
I am starting PHP and I want to improve my concept, if anybody can help, I am so grateful!
Sorry, I forgot to mention this as the table, I would like to use foreach () to show array values.
$ show1 = '& lt; Table range = "1" & gt; '; Forex currency ($ ck = & gt; $ tk as $ time) {$ show1 = '& Lt; Tr & gt; & Lt; Td> . $ CK '& lt; / TD & gt; & Lt; TD & gt; . $ Vaccine '& lt; / TD & gt; & Lt; / TR & gt; '; } $ Show1 = '& Lt; / Table & gt; '; $ Show2 = '& lt; Table range = "1" & gt; '; Forex currency ($ time $ vaccine) {$ show2. = '& Lt; Td> . $ Vaccine '& lt; / TD & gt; '; $ Show2 = '& Lt; Td>: & lt; / Td> '; } $ Show2 = '& Lt; / Table & gt; '; Echo $ show1; Allo $ show2; TheClock (11,12,13);
function clock ($ a, $ b, $ c) {$ Time ['Hour'] = $ a; $ Time ['min'] = $ b; $ Time ['seconds'] = $ c; Return time; } $ Timing = clock (12, 30, 00); $ Hour = $ time ['hour']; $ Min = $ time ['min']; $ Sec = $ time ['seconds']; Print $ hour; // print $ min; // 30 print $ sec; // 120
To use in a foreach loop, according to your edit:
$ html = '& lt; Table range = "1" & gt; '; Forex currency ($ unit = & gt; $ value as $ time) {$ html. = "& Lt; tr & gt; & lt; td & gt; $ unit: & lt; / td & gt; & lt; td & gt; $ value & lt; / td & gt; & lt; / tr & Gt; "; } $ HTML = '& Lt; / Table & gt; ';
Comments
Post a Comment