- var_dump: documentation ( source)
- array_multisort: documentation ( source)
- array_flip: documentation ( source)
<?php
$a1 = ["facebook_like" => 100, "total" => 12, "vote" => 40, "page_view" => 123, "twitter_tweet" => 112, "comment" => 199];
$order = ["total", "page_view", "vote", "facebook_like", "twitter_tweet", "comment"];
array_multisort($a1, array_flip($order));
var_dump($a1);