title: Phaser js php leaderboard
body: <p>I am building a game using the Phaser js framework. Its an endless runner and i have just started.This is the code:</p>
  
  <pre><code>&lt;!doctype html&gt;
  
  &lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;Game2&lt;/title&gt;
      &lt;script type="text/javascript" src="js/phaser.min.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
      &lt;script type="text/javascript"&gt;
          window.onload=function()
          {
              var game=new Phaser.Game(800,600,Phaser.AUTO,'',{preload:preload,create:create,update:update});
              var player;
              var platforms;
              var count=0;
              var t;
              var style;
  
          function preload()
              {
                  game.load.image('ground','assets/platform.png');
                  game.load.image('sky','assets/sky.png');
                  game.load.spritesheet('hero','assets/hero.png',128,128,16);
              }
          function create()
              {
                  game.world.setBounds(0,0,800,600);
  
                  //game.add.sprite(0,0,'sky');
  
                  platforms=game.add.group();
  
                  var ground=platforms.create(0,304,'ground');
  
                  ground.scale.setTo(2,2);
  
                  ground.body.immovable=true;
  
                  //var ledge = platforms.create(400, 400, 'ground');
  
                  //ledge.body.immovable = true;
  
                  //ledge = platforms.create(-150, 250, 'ground');
  
                  //ledge.body.immovable = true;
  
                  player=game.add.sprite(390,32,'hero');
  
                  player.body.bounce.y=0.1;
                  player.body.gravity.y=10;
                  player.body.collideWorldBounds=true;
  
                  player.animations.add('left',[0,1,2,3],10,true);
                  player.animations.add('right',[4,5,6,7],10,true);
                  player.animations.add('stop',[9],10,true);
  
                  game.camera.follow(player);    
  
                  //var count="0";
                  style = { font: "65px Arial", fill: "#ff0044", align: "center" };
                  t = game.add.text(game.world.centerX-350, 0, count, style);
                  //game.time.events.loop(Phaser.Timer.SECOND,distance,this);
              }
  
              function update()
              {
                  distance();
                  game.physics.collide(player,platforms);
                  player.body.velocity.x=0;
  
  
  
                  /*if(game.input.keyboard.isDown(Phaser.Keyboard.LEFT))
                  {
                      player.body.velocity.x=-250;
                      console.log("Left");
                      player.animations.play('left');
                  }
  
                  else if(game.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
                  {
                      player.body.velocity.x=250;
                      console.log("Right");
                      player.animations.play('right');
                  }*/
  
  
                  player.animations.play('right',10,true); //this was done since in an infinite runner the character always runs never stops, the                                                                //only key needed to be pressed is the up key to jump when the platform ends.
  
                  if (game.input.keyboard.isDown(Phaser.Keyboard.UP) &amp;&amp; player.body.touching.down)
                  {
                      player.body.velocity.y = -350;
                  }
  
  
              }
  
               function distance()
              {
                  count++;            //this value will hold the score of every player. I need to pass it to the leader board using php. How?
                  t.content=count;
              }
  
          };
      &lt;/script&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p></p>
  
  <p>i wish to pass the value of the count variable in the distance() function to the leader board using php. How can i do that?</p>