Benny b9 Benny b9

simple scripts php check speed up internet and website

scripts sederhana php mendeteksi kecepatan internet to website. only menggunakan fungsi time or mictotime as pengukur kecepatan that ditempatkan to bagian paling atas and paling bawah halaman web. following scriptsnya :

<?php
    $s_time = microtime(true);
    $s_time = explode(" ", $s_time);
    $s_time = $s_time[0]+$s_time[1];
    $start_speed = $s_time;
?>

<!doctype html>
<html>
<head><title>page</title></head>
<body>

page contents

</body>
</html>

<?php
    $s_time = microtime(true);
    $s_time = explode(" ", $s_time);
    $s_time = $s_time[0]+$s_time[1];
    $finish_speed = $s_time;

    $page_speed = $finish_speed - $start_speed;

    echo "speed internet is".$page_speed."secconts";
?>

scripts fungsi start_speed ditempatkan to permulaan before starting every seccion, bahkan before call connection sql. scripts about not can mendeteksi durasi buffering or how lama loading landing membaca format gambar view 100%. but if menginginkan can ditambahkan fungsi call -satu persatu- kita ambil sample misalnya :

<?php
    $s_time = microtime(true);
    $s_time = explode(" ", $s_time);
    $s_time = $s_time[0]+$s_time[1];
    $start_speed = $s_time;

    $data=0;

    //conect db sql
    $conn = mysql_connect("db_host", "db_user", "db_pwd");



?>

<!doctype html>
<html>
<head><title>page</title></head>
<body>

<?php
    $item = "select * from `my_db` where `id` = '1' ";





?>

</body>
</html>

<?php

    $conn = $data++;
    $item = $data++;


    $s_time = microtime(true);
    $s_time = explode(" ", $s_time);
    $s_time = $s_time[0]+$s_time[1];
    $finish_speed = $s_time;

    $page_speed = $finish_speed - $start_speed;

    echo "speed internet is".$page_speed."secconts";
?>

to fungsi $data++ menghitung kecepatan call satu-persatu every query, kita ambil sample in here that diletakkan to body tengah halaman before start_speed sealready finish_speed , misalnya call:

for($data=0;$data<10000;$data++);

maka hasil result speed change drastis if to $data<10000 diganti menso $data<1 or $data<100000000000 . needed waktu sangat cepat if $data<1 and bertambah semakin lama if $data<100000000000

 

begitu check kecepatan web page demonya -> simple scripts php check speed up internet and website

 


By Benny b9 at May 06 2020 Link :b9 follow us on :facebook twitter youtube || share to Facebook Tweitter WhatsApp
.
Most loggedin to submit comment.