How to make a wave of such a sample:
["Hello", "Hello", "Hello", "Hello", "Hello"]
code is, but it gives a little not true result:
function wave ($ people) {
$ array = [];
$ i = 0;
While ($ I & LT; Strlen ($ PEOPLE)) {
$ people [$ i] = STRToupPer ($ PEOPLE [$ i]);
$ array [] = $ PEOPLE;
$ i ++;
}
VAR_DUMP ($ array);
}
Echo Wave ('Hello');
Answer 1, Authority 100%
Let’s say so
function wave ($ people) {
$ array = [];
$ i = 0;
While ($ I & LT; Strlen ($ PEOPLE)) {
$ temp = $ people;
$ TEMP [$ i] = Strtoupper ($ PEOPLE [$ i]);
$ array [] = $ temp;
$ i ++;
}
VAR_DUMP ($ array);
}
Echo Wave ('Hello');
No need to rub each time the previous value.
Answer 2
function wave ($ sting) {
For ($ i = 0; $ I & LT; Strlen ($ Sting); ++ $ i) {
if ($ Sting [$ i] == '') Continue;
$ Result [] = substr_replace ($ Sting, StrToupper ($ Sting [$ i]), $ i, 1);
}
Return $ Result;
}
Print_R (Wave ('Hello World'));