Output sorting

Hi,

May I know is there any function that I can use to have 3 digits number re-arranged to small to big ?
something like

762

then the output will be 267.

Please advise. thanks

You can use following snippet:


function revNum($src) {
  return 0 + strrev($src . "");
}


<?php
function _sort($number){
  $arr = str_split($number);
  sort($arr, SORT_NUMERIC);
  return implode(null, $arr);
}

var_dump(
  _sort(74286935)
);

#string(8) "23456789"