Skip to main content
12 events
when toggle format what by license comment
Apr 13, 2017 at 12:39 history edited CommunityBot
replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/
Dec 2, 2016 at 20:19 comment added MonkeyZeus @tbodt It's actually a well-known language construct and PHP is definitely full of fun little surprises :-)
Dec 2, 2016 at 13:12 history edited MonkeyZeus CC BY-SA 3.0
added 208 characters in body
Dec 2, 2016 at 3:15 comment added whitehat101 Also note that $a is never declared, and starts with a value of NULL. By assigning a value with square brackets $a[]=, you're implicitly casting NULL to an empty array, and then appending a value.
Dec 1, 2016 at 23:50 comment added tbodt Didn't know that $a[] = x adds an element to an array in PHP. I would classify that as a bizarre quirk since I don't know of any other language that does that.
Dec 1, 2016 at 23:08 comment added Titus while($a.=1); indefinetely adds characters to a string.
Dec 1, 2016 at 22:11 comment added Alex Howansky You can chop a byte with while($a.=1); -- just build a huge string versus a huge array.
Dec 1, 2016 at 21:52 comment added MonkeyZeus @tbodt Try it out at sandbox.onlinephpfunctions.com
Dec 1, 2016 at 21:49 review Low quality posts
Dec 1, 2016 at 21:53
Dec 1, 2016 at 21:38 comment added MonkeyZeus @tbodt $a[]=1 evaluates to something truthy so the while() loop equates to while(true) and just keeps looping and adding elements to the $a array. Not sure if this can be classified as a quirk though. Is identifying a quirk a requirement of your question? Would you like me to deconstruct my answer into multiple lines?
Dec 1, 2016 at 21:35 comment added tbodt Which bizarre quirk of php does this exploit?
Dec 1, 2016 at 21:33 history answered MonkeyZeus CC BY-SA 3.0