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....)?

Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8

© 2023 GoRails, LLC. All rights reserved.