To sort a string array in PHP in dictionary order, you can use the `sort()` function. To sort in descending order, you can use the `rsort()` function.
In this example,
<?php
$words = ["banana", "apple", "orange", "grape"];
sort($words);
print_r("Sorted Array Ascending: ");
print_r($words);
?>
Sorted Array Ascending: Array ( [0] => apple [1] => banana [2] => grape [3] => orange )
In this example,
<?php
$words = ["banana", "apple", "orange", "grape"];
rsort($words);
print_r("Sorted Array Descending: ");
print_r($words);
?>
Sorted Array Descending: Array ( [0] => orange [1] => grape [2] => banana [3] => apple )
In this tutorial, we learned How to Sort a String Array in Dictionary Order in PHP language with well detailed examples.