Note that there are some explanatory texts on larger screens.

plurals
  1. POrand() only returns 1 as an answer
    primarykey
    data
    text
    <p>I was trying to randomly switch between 10 animations using a combination of php and css using this code. It everything works except that the rand() always comes out as "1" no matter how many times I reload the page or open and close the tab. What am I doing wrong?</p> <pre><code>&lt;style type="text/css"&gt; #a {width:200; height:200; background-color:black; color:red; font-size:30; position:relative; left:50; top:50; &lt;?php $z=mt_rand(1,10); if ($z="1") {echo "animation:a 5s linear 1s infinite alternate; -webkit-animation:a 5s linear 1s infinite alternate; -mox-animation:a 5s linear 1s infinite alternate; -o-animation:a 5s linear 1s infinite alternate;";} elseif($z="2") {echo "animation:b 5s linear 1s infinite alternate; -webkit-animation:b 5s linear 1s infinite alternate; -mox-animation:b 5s linear 1s infinite alternate; -o-animation:b 5s linear 1s infinite alternate;";} elseif($z="3") {echo "animation:c 5s linear 1s infinite alternate; -webkit-animation:c 5s linear 1s infinite alternate; -mox-animation:c 5s linear 1s infinite alternate; -o-animation:c 5s linear 1s infinite alternate;";} elseif($z="4") {echo "animation:d 5s linear 1s infinite alternate; -webkit-animation:d 5s linear 1s infinite alternate; -mox-animation:d 5s linear 1s infinite alternate; -o-animation:d 5s linear 1s infinite alternate;";} elseif($z="5") {echo "animation:e 5s linear 1s infinite alternate; -webkit-animation:e 5s linear 1s infinite alternate; -mox-animation:e 5s linear 1s infinite alternate; -o-animation:e 5s linear 1s infinite alternate;";} elseif($z="6") {echo "animation:f 5s linear 1s infinite alternate; -webkit-animation:f 5s linear 1s infinite alternate; -mox-animation:f 5s linear 1s infinite alternate; -o-animation:f 5s linear 1s infinite alternate;";} elseif($z="7") {echo "animation:g 5s linear 1s infinite alternate; -webkit-animation:g 5s linear 1s infinite alternate; -mox-animation:g 5s linear 1s infinite alternate; -o-animation:g 5s linear 1s infinite alternate;";} elseif($z="8") {echo "animation:h 5s linear 1s infinite alternate; -webkit-animation:h 5s linear 1s infinite alternate; -mox-animation:h 5s linear 1s infinite alternate; -o-animation:h 5s linear 1s infinite alternate;";} elseif($z="9") {echo "animation:i 5s linear 1s infinite alternate; -webkit-animation:i 5s linear 1s infinite alternate; -mox-animation:i 5s linear 1s infinite alternate; -o-animation:i 5s linear 1s infinite alternate;";} elseif($z="10") {echo "animation:j 5s linear 1s infinite alternate; -webkit-animation:j 5s linear 1s infinite alternate; -mox-animation:j 5s linear 1s infinite alternate; -o-animation:j 5s linear 1s infinite alternate;";} ?&gt; } &lt;/style&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload