1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Help Needed on Converting specific javascript commands to php such as math.random()

Discussion in 'PHP' started by ProductivePC, May 29, 2004.

  1. #1
    I have been searching and studying for something in php that will take the place of the math.random() function in javaScript. Does anyone know of anything?

    =======================================================

    If you do I am also having problem with conveting the following functions from javaScript to PHP.

    sc_img = new Image();
    sc_img.src = sc_tracking_url;

    sc_date = new Date();
    sc_time = sc_date.getTime();
    sc_agent = sc_agent.toUpperCase();

    This is all I have left prior to testing the script. If anyone has any ideas... please let me know.

    Thanks in advance.

    Wayne
     
    ProductivePC, May 29, 2004 IP
  2. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,333
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #2
    digitalpoint, May 30, 2004 IP
  3. ProductivePC

    ProductivePC Peon

    Messages:
    362
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #3
    okay I saw that but could not make out if I just left it at rand(); instead of math.random(); or did I have to include numbers inside of there....

    any insight?

    Also do you know of anything that will replace the following

    sc_img = new Image();
    sc_img.src = sc_tracking_url;

    sc_time = sc_date.getTime();
    sc_agent = sc_agent.toUpperCase();

    ------------------------------------------------------------------------
    The below are correct then?
    sc_date = new Date(); --> $sc_date=date('Y');
    math.random(); --> rand();

    thanks for any help

    Wayne
     
    ProductivePC, May 30, 2004 IP
  4. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,333
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #4
    I believe the numbers are optional, but you may want to test it to confirm.
     
    digitalpoint, May 30, 2004 IP
  5. xml

    xml Peon

    Messages:
    254
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #5
    sc_img = new Image(); --> X
    sc_img.src = sc_tracking_url; --> X
    Code (markup):
    I don't get what your trying to do here.
    So I'm guessing something like:

    $images = array("/myIMG.gif", "/anotherIMG.gif", "oneMoreIMG.gif");
    
    foreach ($images as $image) {
    	echo "<p><img src=\"$image\" /></p>";
    }
    
    sc_time = sc_date.getTime(); --> date("H:i:s");
    sc_agent = sc_agent.toUpperCase(); --> strtoupper("my lowercase string is now uppercase");
    PHP:
     
    xml, Jun 6, 2004 IP