Why this problem?


#1

This is my code:


<?php
$family = array();
array_push($family, "joe");
array_push($family, "bill");
array_push($family, "carl");
$sorted = sort($family);
$rand = rand(0, count($sorted) -1);
$select = $sorted[$rand]
print $select;
strtoupper();
?>


This is my problem: Oops, try again. Make sure the name you print out is in ALL CAPS!

Can you Help me?


#2

because your do not call your strtoupper(); on your $select, you should call to upper on $select:

print strtoupper($select);

for next time, use one of the two following options to make your code/indent visible:

select your code and press ctrl + shift + c (or cmd + shift + c if you use a mac)

if this instructions are unclear, you can also insert 3 backticks before and after your code, like so:

```
<p>visible</p>
```

the backtick is located above the tab key on your keyboard


#3

Can you write me the right code please?


#4

I did write the right code


#5

New problem: Oops, try again. Remember to print out the name of the lucky winner!


#6

Hm... okay. Could you provided a updated version of your code? Just posting that there is a new problem, is so frustrating!!


#7

I've resolved my problem. Thanks for helping! :ghignante:


#8

can u pls help ,me how did u solved tht problem


#9

Well, yes we can. But please read the guide-lines first, they will tell you to show us your code, so we can help you. We can't do anything with an remark like please help me


#10

<?php
$family = array();
array_push($family, "joe");
array_push($family, "bill");
array_push($family, "carl");
$sorted = sort($family);
$rand = rand(0, count($sorted) -1);
$select = $sorted[$rand];
print strtoupper($select);
?>


#11

after $sorted = sort($family);, add this line:

echo count($sorted);

as you can see, count sorted is only one. so your rand goes from 0 till 1-1. You might want to fix this


#12

still the same problem...


#13

I didn't say it solved the problem, it indicates where the problem is. I am here to help you, not to provide you with the full answer