hi2you Posted March 1, 2008 Share Posted March 1, 2008 Hello, Does anyone know how to convert javascript code to PHP code?? Thanks Quote Link to comment Share on other sites More sharing options...
trq Posted March 1, 2008 Share Posted March 1, 2008 Depends what it does. Generally speaking though they are two completely different things. Javascript runs on the client while php runs on the server. Quote Link to comment Share on other sites More sharing options...
trq Posted March 1, 2008 Share Posted March 1, 2008 Either way you'll need to do it manually, I can't say it would be very common at all. Quote Link to comment Share on other sites More sharing options...
Michan Posted March 1, 2008 Share Posted March 1, 2008 You can't convert Javascript to PHP, but Javascript is extremely similar to PHP. The odds are that if you have a function or chunk of code in Javascript, you can probably tweak it a little to a similar thing in PHP. However, PHP is read by the server, whereas Javascript is read by the browser, so different types of things can be manipulated in the different languages. Like many other languages, they compliment each other very well. Quote Link to comment Share on other sites More sharing options...
hi2you Posted March 1, 2008 Author Share Posted March 1, 2008 Just a thought, is it possible to "echo" all the javascript code and it becomes PHP?? Quote Link to comment Share on other sites More sharing options...
peranha Posted March 1, 2008 Share Posted March 1, 2008 echo prints it to the browser Quote Link to comment Share on other sites More sharing options...
trq Posted March 1, 2008 Share Posted March 1, 2008 Just a thought, is it possible to "echo" all the javascript code and it becomes PHP?? No. Thats makes no sense. maybe if you tell us what you need to do instead of guessing at solutions we might be able to actually help. Quote Link to comment Share on other sites More sharing options...
hi2you Posted March 1, 2008 Author Share Posted March 1, 2008 I want to hide those code from the user. Quote Link to comment Share on other sites More sharing options...
Michan Posted March 1, 2008 Share Posted March 1, 2008 I want to hide those code from the user. You can't hide Javascript from the user. You could put it in an external file and call it, which will make it harder for the user to gain access to your code, but it's not possible to hide browser-driving code from the.. browser. Quote Link to comment Share on other sites More sharing options...
trq Posted March 1, 2008 Share Posted March 1, 2008 You can't hide javascript form the client. Its is interpreted by the browser. Best you could do would be obfuscation, but that can be easily worked around. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.