There's no benefit for the example you gave above (beyond peculiar deployment scenarios where you have access to .php files and not .js files, which would be insane but not unheard of). That said, this approach allows you to pass the JS through the php parser - which means you can generate your JS dynamically based on server variables.
Converting Python ByteArray -> Php [duplicate]
Update MySQL with .html() in JQUERY/AJAX
InstantClick disables form submit
HTTP request failed in PHP Bad Request
PHP - File get contents and proper encoding
Error (check link)
CI - Help Inserting Multiple Select Form with each having Multiple Selected Options
How to output variable inside an object in PHP
How $_POST value missing unless field specified within model rules?
Addind DISCUS commenting system to your site
Incorrectly executed script for the selection of IP addresses
How to calculate time range between sale start and sale end including the second?
Dynamically add columns in an existing table on the fly in CakePHP 3
Custom post query in single post type
PHP check value against multiple values with OR-operator
Incorrect table definition; there can be only one auto column and it must be defined as a key Codeigniter