hi2you Posted March 1, 2008 Share Posted March 1, 2008 Hello, Does anyone know how to convert javascript code to PHP code?? Thanks Link to comment https://forums.phpfreaks.com/topic/93807-convert-javascript-to-php/ 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. Link to comment https://forums.phpfreaks.com/topic/93807-convert-javascript-to-php/#findComment-480675 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. Link to comment https://forums.phpfreaks.com/topic/93807-convert-javascript-to-php/#findComment-480676 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. Link to comment https://forums.phpfreaks.com/topic/93807-convert-javascript-to-php/#findComment-480679 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?? Link to comment https://forums.phpfreaks.com/topic/93807-convert-javascript-to-php/#findComment-480684 Share on other sites More sharing options...
peranha Posted March 1, 2008 Share Posted March 1, 2008 echo prints it to the browser Link to comment https://forums.phpfreaks.com/topic/93807-convert-javascript-to-php/#findComment-480686 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. Link to comment https://forums.phpfreaks.com/topic/93807-convert-javascript-to-php/#findComment-480688 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. Link to comment https://forums.phpfreaks.com/topic/93807-convert-javascript-to-php/#findComment-480689 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. Link to comment https://forums.phpfreaks.com/topic/93807-convert-javascript-to-php/#findComment-480692 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. Link to comment https://forums.phpfreaks.com/topic/93807-convert-javascript-to-php/#findComment-480693 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.