-6

I would like to know how to make use of the variable hash in a PHP variable

var hash = md5(a);
EnexoOnoma
  • 8,454
  • 18
  • 94
  • 179
  • 1
    You don't "make use" of a JS variable in PHP. This suggests misunderstanding of how the web works. – elclanrs Aug 06 '14 at 17:59
  • 1
    JavaScript is run on the client, so you'll need to send it back with AJAX. But, MD5() can be calculated perfectly well by PHP - can you add more context to your question? It is getting downvoted since you haven't evidenced any research, which is pretty much a prerequisite here. – halfer Aug 06 '14 at 17:59
  • Explain what you're really trying to do and you will get the best advice. You almost definitely are taking the wrong approach. – Wesley Murch Aug 06 '14 at 18:00
  • 1
    Haven't you posted [this question](http://stackoverflow.com/questions/25159306/how-to-save-this-in-a-js-variable) [multiple times](http://stackoverflow.com/questions/25159035/how-to-save-the-output-and-not-the-code-from-this-js-to-a-php-variable) before? – admdrew Aug 06 '14 at 18:00
  • You can make an HTTP request to the server and send the value. – Felix Kling Aug 06 '14 at 18:01
  • 1
    Thanks @WesleyMurch, agreed and I retracted my vote before it closed. I think it's [a dup of this](https://stackoverflow.com/questions/25159035/how-to-save-the-output-and-not-the-code-from-this-js-to-a-php-variable) instead, one of the OP's other earlier questions. – halfer Aug 06 '14 at 18:07

1 Answers1

-3

Here is the equivalent in PHP:

$hash = md5($a);

hawkharris
  • 2,570
  • 6
  • 25
  • 36
  • I tried this but because of the library I use in JS it is not the same. – EnexoOnoma Aug 06 '14 at 18:00
  • Can you post an example of your code to give more context? It's hard to make direct comparisons between PHP and JS because they work very differently. (PHP is a server side language and JS is client side.) – hawkharris Aug 06 '14 at 18:02
  • @hawkharris: I've not downvoted on your answer, but the reasons for these downvotes are likely that the answer is deemed too trivial, or that the question is clearly off-topic and so the OP should have found out the answer for him/herself. In this case the OP has posted several identical (or very similar) questions, and so it is probably best to just downvote and move on. If you believe a question will close, it's often best not to answer, unless your answer is of such length and quality that it will get upvotes notwithstanding the question's status. – halfer Aug 06 '14 at 18:09
  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. – Deepanshu J bedi Aug 06 '14 at 18:58
  • @DeepanshuBedi Please use VTD reasons appropriately. Voting to delete answers isn't to be used for technical inaccuracies. – Qix - MONICA WAS MISTREATED Aug 06 '14 at 19:40
  • @Fataoulas To find the answer you're looking for, I think you'll have to do a little research on the relationship between PHP and JavaScript. You can't really make a one-to-one comparison because they have fundamentally different uses. This other S.O. post does a good job of explaining the differences. I hope it helps: http://stackoverflow.com/questions/6369313/difference-between-javascript-and-php – hawkharris Aug 08 '14 at 13:37