-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnormal.php
More file actions
36 lines (36 loc) · 751 Bytes
/
normal.php
File metadata and controls
36 lines (36 loc) · 751 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
/**
* This function is SUPPOSED to take an "owner" string
* and return an array of "rides" possessed by that "owner".
*
* Can you fix the code below so it works as expected?
*/
function ride($owner) {
$rides = array('car', 'boat', 'bike');
$arr_length = count($rides);
for($i = 0; $i < $arr_length; $i++) {
array_push($rides, $owner . "'s " . $rides[$i]);
}
return $rides;
}
?>
<!DOCTYPE html>
<html>
<head></head>
<body>
<p>
<pre>
<?php
print_r(ride('Jason'));
?>
</pre>
</p>
<p>
<pre>
<?php
print_r(ride('Eric'));
?>
</pre>
</p>
</body>
</html>