I need the following 3 line Ruby snippet to be transformed to PHP
[url removed, login to view]!(/(\A|^$\n)(^\w[^\n]*\n)(^\w[^\n]*$)+/m) do |x|
[url removed, login to view](/^(.+)$/, "\\1 ")
The PHP function should perform in exactly the same way. 30$ maximum and do not send any references etc. instead please confirm that you are able to transform the code in the private message.