Skip to content

Instantly share code, notes, and snippets.

@tdkn
Last active July 2, 2018 07:54
Show Gist options
  • Save tdkn/6f40048ab2ac80982bf74a48073686e9 to your computer and use it in GitHub Desktop.
Save tdkn/6f40048ab2ac80982bf74a48073686e9 to your computer and use it in GitHub Desktop.
ドット区切りのソート用文字列をパースするやつ
$order = 'table_name.column.desc';
list($direction, $column) = array_map(
'strrev',
explode('.', strrev($order), 2)
);
echo $direction; // "desc"
echo $column; // "table_name.column"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment