vampster
Joined
60 Experience
0 Lessons Completed
0 Questions Solved
Activity
Posted in migrating to php
Thanks for your help Jacob. I understand better now.
Posted in migrating to php
Hello,
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 = Digest::MD5.new
for arg in args do
digest << arg.to_s
end
digest.hexdigest
end
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....)?