Performance-wise, which would be the better solution? Here’s a really small example. The PHP script returns a number to jQuery, which needs to be checked if it’s 1, the page needs to say “1 person”, else “X persons”.
Would it be faster for the PHP script to make this check and return “x persons”, or for jQuery to do it after getting the number?
I’m assuming you have a different case going on, and this is just an example -overly simplified-. The check is a very small one, so I doubt you can measure difference, but lets say you have LOTS of these checks.
As @mkoryak says, jQuery is clientside and PHP is serverside. If 10^5 users are requesting this, you might see some difference when letting jQuery do this: everyone does it once (and doesn’t see the difference), but your server gets to do 10^5 checks less. The other way around, your server is probably a lot quicker then your client, so a lot of calculations for 1 client (with few, or even a single client) might be better run on the server (so PHP would be your choice).
As @slebetman concludes: For small number of clients, server side code is generally faster. For very large number of clients, offloading work to client side code can greatly improve performance. Here is where @scunliffe ‘s answer comes in: test your sollution with a stresstest!