php - Why does $n = $n + $n not work -


i've tried out code use loop in php add numbers seems not work, how can be?

$n = 3; //or else for($i=0;$i<$n;$i++){    $n = $n+$n; } echo $n; 

this test code else, i'd still work, please help

you increasing loop ending condition $n inside loop

this means never exit loop.

this infinite loop, , wont ever print anything.

also loop needs $i = 0; $i < $n; $i++


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -