I don't understand...

Add a reply

Posted by AngryPanda 759 days ago:
Can anyone give me a PHP example of how the code receives the data ? For example , for the switchboard challenge ? I ran all the tests that the challenge page gave by copying and pasting the switchboard into my script , but how do I put the data in a string when I upload to the site ?


Also , I have a very spacious style of coding. Is there any sort of whitespace condensing done by the site? For example...

for ( $x = 0 ; $x < $whatever ; $x ++ )
{
$array [ 'levelone' ] [ 'leveltwo' ] = 'value' ;
}


As you can see, I put a space just about everywhere... should I get rid of these before uploading?
Posted by Zapp 758 days ago:
Hi AngryPanda.

To get any input from STDIN in PHP, have look at:
http://codegolf.com/boards/conversation/view/129

.. and YES, you should get rid of any unnecessary whitespace or newline
every byte counts!

have fun
Zapp
Posted by AngryPanda 758 days ago:
Thanks a lot for that ! I was indeed one of the PHPers who had never worked with STDIN (only in c).

That little tidbit took me from 1798 failing bytes to 162 passing bytes :)
Posted by Zapp 757 days ago:
Damn! nice work..
it took me 213 bytes, but i don't know where to save another 51 bytes ..
i'm keen on getting a look on those <100 byte or even <213 byte code ;)

Zapp
Posted by deanWombourne 632 days ago:
Hi Guys,

I'm also having a problem with stdin. I can read from it fine, I just don't know how to tell when there is no more data!

I'm trying the ascii art challenge to get me started but I get timeout errors each time it runs. I think this is beacuse I am waiting for more input which never arrives?

I know that the answer is going to be obvious but any ideas anyone?


Thanks,
Posted by deanWombourne 632 days ago:
Found the problem. All fixed now.

Thanks.

Add a reply