15 Replies
why when i put echo in loop
it will show 8 start
and when i put echo outside loop it show only 1 star
in javascript for fix the issue i do $star_1 += "*" ;
but in php i cant
is there any way i get like 8 start every time i call it ?
not only 1
because you can't increment an asterisk by an asterisk
hmm
you probably want to do
$star .= '*'$star += '*'
but what you REALLY want is
str_repeat('*', 8)oh i dont need make for loop for this
?
is this bulid in func ?
yes
oh nice
is this also in js ?
this doesn't work because it is the same as
$star = (int)$star + (int)'*' which makes no sense
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat <-- '*'.repeat(8)tnx for help
you're welcome
in php, you want to do
$star .= '*', by the way,
the
. is used to concatenate strings, meaning that it is the same as this: $star = $star . '*'ohh