I'd like to know is there a string hashing function that would produce identical results both in JavaScript and PHP, just to avoid text transmissions in cases when some textual data coming from the client side needs to be verified on the server side for being the same as expected?
Yes, See this md5 hashing function for JS. Here is sha1.
You'd find more in http://PHPjs.org
There are a variety of string hashing algorithms you can select from. Google will give you lots of choices. One popular algorithm is MD5 which I'm sure you can find implementations for in both javascript and PHP. Here's one reference on MD5 with javascript code and here's a second reference for javascript.
MD5 has the characteristic you are seeking that the same string always produces the same hash value and it can be implemented in any language.
I don't know PHP myself, but it appears that PHP might already have a function called md5()
built in. See here for a reference.
If you use MD5 hashing, you will get the same result in both javascript and PHP