如何使用PHP将泰语日期转换为英语?

Currently i am doing format of date from THAI To English Language but it could not format date from THAI to English. I researched on Google but i could not found anything over there.

Following is my THAI date formate

15 กรกฎาคม 2562

One solution with str_replace

<?php
$search = [
    // Here thai months from 1 to 6
    'กรกฎาคม',
    // And the rest here
];
$replace = [
    // Here eng months from 1 to 6
    'July',
    // And the rest here
];

$tdate = '15 กรกฎาคม 2562';
$edate = str_replace($search, $replace, $tdate);

var_dump($edate);

replace your word with thai word by making an array

 $pairs = ["กรกฎาคม"=>"july", "month"=>"englishmonth", "three"=>"one"];

    $r = preg_replace_callback(
        "/\w+/",                           # only match whole words
        function($m) use ($pairs) {
            if (isset($pairs[$m[0]])) {     # optional: strtolower
                return $pairs[$m[0]];      
            }
            else {
                return $m[0];              # keep unreplaced
            }
        },
        $source
    );

Thanks you guys. I have solved this issues. Below is my code.

$date = explode(" " , "15 กรกฎาคม 2562");
$EnglishYear = $date[2] - 543;
$testKey = '';
$monthNamesThai = array("มกราคม","กุมภาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน",
"กรกฎาคม","สิงหาคม","กันยายน","ตุลาคม","พฤษจิกายน","ธันวาคม");
$monthNameEnglish = array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
foreach($monthNamesThai as $key => $monthNamesThai){
    if($date[1] == $monthNamesThai){
        $testKey = $key;
    }
}
$resultDate = $date[0]." ".$monthNameEnglish[$testKey]." ".$EnglishYear;
echo $resultDate;