php Rand equivalence of javascript rand

Discussion in 'PHP' started by Silver89, Feb 18, 2009.

  1. #1
    Hi,

    What's the equivalence of this javascript rand in php?

    Math.round(Math.random()*999999);
    Code (markup):
    Thanks
     
    Silver89, Feb 18, 2009 IP
  2. Altari

    Altari Peon

    Messages:
    188
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    $number = round(rand(1, 999999));
    PHP:
    You could also use ceil() [to always round up] and floor() [to always round down].
     
    Altari, Feb 18, 2009 IP
    Silver89 likes this.