On the Web Builder Zone there's a quick article from Stoimen Popov showing a quicksort algorithm in both PHP and Javascript versions:
Let me show you one sorting algorithm, perhaps the most known of all them – the quick sort, implemented both on PHP and JavaScript. Although the code look similar between both languages, there are few differences, that show the importance of the syntax knowledge!
Most of the post is taken up with the two code examples - the PHP one sorting arrays with a for loop and a call to array_merge and the Javascript side pushing values into an array and calling "concat" on it to get the right values.