Hacker News new | ask | show | jobs
by maxxxxx 3092 days ago
I think your code will work because 1234 can be converted to a string. I think the trouble starts once you pass around objects.
1 comments

It actually doesn't according to http://sandbox.onlinephpfunctions.com/code/8804b49c23d620228..., though different PHP versions could produce different results.
This works with PHP 7

<?php //Enter your code here, enjoy!

function foo(string $bar) { return $bar . $bar; }

echo foo(1234);