Parse error: syntax error, unexpected '.1' (T_DNUMBER) in C:\webserver\function\GrabStatus.php on line 7 -


i'm getting error

parse error: syntax error, unexpected '.1' (t_dnumber) in c:\webserver\function\grabstatus.php on line 7 

in websites php minecraft server ping script

here's code i'm using:

<?php $settings = parse_ini_file('../db.ini',true);  $ipandport = explode(':',$settings['mcserver']['ip']); if(empty($ipandport[1])) { $ipandport[1] = 192.168.1.33:27747; }  // edit -> define( 'mq_server_addr', $ipandport[0]); define( 'mq_server_port', $ipandport[1]); define( 'mq_timeout', 1 ); // edit <-  // display in browser, because people can't in logs errors error_reporting( e_all | e_strict ); ini_set( 'display_errors', true );  require __dir__ . '/minecraftserverping.php';  $timer = microtime( true );  $info = false; $query = null;  try {     $query = new minecraftping( mq_server_addr, mq_server_port, mq_timeout );      $info = $query->query( );      if( $info === false )     {         /*          * if server older 1.7, can try querying again using older protocol          * function returns data in different format, have manually map          * things if want match 1.7's output          *          * if know sure server using older version,          * can directly call queryoldpre17 , avoid query() , reconnection part          */          $query->close( );         $query->connect( );          $info = $query->queryoldpre17( );     } } catch( minecraftpingexception $e ) {     $exception = $e; }  if( $query !== null ) {     $query->close( ); }  $timer = number_format( microtime( true ) - $timer, 4, '.', '' );    if(isset($info['players'])) {  echo $info['description'].'<br>'; echo 'players: '.$info['players']['online'].' / '.$info['players']['max'].'<br>'; echo 'ping: '.$timer; echo '<br><br>';  } else { echo 'server offline.'; } ?> 

what doing wrong?

192.168.1.33:27747 not valid number

you should write this

$ipandport[1] = '192.168.1.33:27747'; 

Comments

Popular posts from this blog

node.js - How to mock a third-party api calls in the backend -

java - Could not locate OpenAL library -

Non Unique Username with ASP.Net Identity 2.0 -