Skip to content

Instantly share code, notes, and snippets.

View akutaktau's full-sized avatar

Jasdy Syarman Mohd Saari akutaktau

View GitHub Profile
@akutaktau
akutaktau / json_file_put.php
Created August 17, 2021 01:00
Sample how to convert csv from KKM repo to json
<?php
//path to local json file.
$json_uri = "C:\Dev\covid-19\covid-19-states-daily-cases.json";
//path to KKM csv
$fetch_uri = "https://raw.githubusercontent.com/MoH-Malaysia/covid19-public/main/epidemic/cases_state.csv";
//open csv
$file = fopen($fetch_uri,'r');
<?php
echo '<pre>';
$arr1 = ['1','2','3','4'];
$arr2 = ['1','2','3','3','4','4','5','5','6','6','7','8','9'];
//done 1
$arr1Low = arsort($arr1);
print_r($arr1Low);
echo '<br />';
//done 2
@akutaktau
akutaktau / index.php
Last active March 29, 2017 06:17
Trigger which version Whatsapp to sent messages
<?php
/**
Thanks stackoverflow
*/
function getOS($user_agent) {
$os_array = array(
'/windows nt 10/i' => 'Windows 10',
'/windows nt 6.3/i' => 'Windows 8.1',
'/windows nt 6.2/i' => 'Windows 8',
'/windows nt 6.1/i' => 'Windows 7',