php code to display the Latest reading from a Array
<p>I have a code which will Display the log file data in the attached format,
Here it will display all the readings in the table 
I need to display only the Latest or Last Reading how to display that?Please help me.I have attached the Log file in the link
<a href="https://www.dropbox.com/s/nanne31awysgl5u/192.168.1.12_10000-gprs20160525.log?dl=0" rel="nofollow">Log File</a></p>

<pre><code> &lt;meta http-equiv="refresh" content="10" &gt; 
 &lt;html&gt;
 &lt;h1&gt;&lt;center&gt;Online Real Time Temperature and Pressure Monitoring System&lt;/center&gt;&lt;/h1&gt;
 &lt;head&gt;
 &lt;style&gt;
 table,th,td{
border:1px solid black;
border-collapse: collapse;
}
th,td{
padding: 5px;
}
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;table align ="center" style="width:60%"&gt;
&lt;tr&gt;
&lt;th&gt;Year&lt;/th&gt;
&lt;th&gt;Month&lt;/th&gt;
&lt;th&gt;Date&lt;/th&gt;
&lt;th&gt;Time&lt;/th&gt;
&lt;th&gt;Sensor ID&lt;/th&gt;
&lt;th&gt;Position&lt;/th&gt;
&lt;th&gt;Pressure(psi)&lt;/th&gt;
&lt;th&gt;Temperature&lt;/th&gt;
&lt;/tr&gt;
&lt;/body&gt;
&lt;/html&gt;
&lt;?PHP
error_reporting(E_ALL &amp; ~E_NOTICE);
$file_handle = fopen("D:/192.168.1.12_10000-gprs20160525.log", "rb");
while (!feof($file_handle) ) {
$line_of_text = fgets($file_handle);
$parts = explode(' ', $line_of_text);
$finalstr=$parts[0]."&lt;BR&gt;";
$hello=explode('&gt;',end($parts));
$hello2=$hello[0]."&lt;BR&gt;";
$hello3=strlen($hello2);
if($hello3==23){
$timestamp=$hello2;
}
elseif($hello3==27)
{
$data=$hello2;
$hello4=explode('-',$timestamp."-".$data);
$year = substr($hello4[0],1,4);
$Month = substr($hello4[0],5,2);
$Date = substr($hello4[0],7,2);
$Hour = substr($hello4[0],9,2);
$Min = substr($hello4[0],11,2);
$sec =  substr($hello4[0],13,2);
$time= $Hour.":".$Min.":".$sec;
$sensorid1=substr($hello4[1],4,2);
$sensorid2=substr($hello4[1],7,2);
$Pressure1=substr($hello4[1],10,2);
$Pressure2=substr($hello4[1],13,2);
$temperature=substr($hello4[1],16,2);
$finalsensor=$sensorid1.$sensorid2;
$finalPressure=$Pressure1.$Pressure2;
$finalPressure1=(hexdec($finalPressure)-1531)/100+0.61;
$finaltemperature1=hexdec($temperature)-40;
$position="FL";

 ?&gt;
 &lt;html&gt;
 &lt;head&gt;

 &lt;/head&gt;
 &lt;body&gt;

  &lt;tr&gt;
  &lt;td&gt;&lt;center&gt;&lt;?php echo ($year);?&gt;&lt;/center&gt;&lt;/td&gt;
  &lt;td&gt;&lt;center&gt;&lt;?php echo ($Month); ?&gt;&lt;/center&gt;&lt;/td&gt;
  &lt;td&gt;&lt;center&gt;&lt;?php echo ($Date); ?&gt;&lt;/center&gt;&lt;/td&gt;
  &lt;td&gt;&lt;center&gt;&lt;?php echo ($time); ?&gt;&lt;/center&gt;&lt;/td&gt;
  &lt;td&gt;&lt;center&gt;&lt;?php echo ($finalsensor); ?&gt;&lt;/center&gt;&lt;/td&gt;
  &lt;td&gt;&lt;center&gt;&lt;?php echo ($position); ?&gt;&lt;/center&gt;&lt;/td&gt;
  &lt;td&gt;&lt;center&gt;&lt;?php echo ($finalPressure1); ?&gt;&lt;/center&gt;&lt;/td&gt;
  &lt;td&gt;&lt;center&gt;&lt;?php echo ($finaltemperature1); ?&gt;&lt;/center&gt;&lt;/td&gt;


  &lt;/tr&gt;
  &lt;/body&gt;
 &lt;/html&gt;
  &lt;?php
  }
  elseif($hello3==50)
  {
   echo "";
   }
   }
  fclose($file_handle);

   ?&gt;
</code></pre>