Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I think your code will work because 1234 can be converted to a string. I think the trouble starts once you pass around objects.


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);




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: