60 Experience
0 Lessons Completed
0 Questions Solved


Posted in migrating to php

Thanks for your help Jacob. I understand better now.

Posted in migrating to php

I have inherited a ruby application and unfortunately have no knowledge of the language.
Could someone be so kind to help me figure out how to convert the below code to php?

  def generate_md5(*args)
    digest =
    for arg in args do
      digest << arg.to_s

I have tried to get the same output in php, but I am failing.
I do not understand what happens in the for each loop.
The << seems to be equivalent to "update". What exactly does this update do?
Does it use the original hash, concatenate the new argument to it and hash the resulting string?
(this does not seem to generate the same output in php)
Or am I completely misunderstanding this (which is quite likely....)?