|
Posted by Rami Elomaa on 04/18/07 08:37
"Toby A Inkster" <usenet200703@tobyinkster.co.uk> wrote in message
news:v1ugf4-9qv.ln1@ophelia.g5n.co.uk...
> Rami Elomaa wrote:
>
>> <?php
>> $i++;
>> if($i<10) xyz (__FILE__) ;
>> else echo $i;
>> ?>
>>
>> Substitute xyz with a standard function or construct so that the output
>> is 10.
>
> My immediate thought would be...
>
> <?php
> $i++;
> if($i<10) echo preg_replace('/[^\d]/','',file_get_contents(__FILE__));
> else echo $i;
> ?>
>
Well, that's quite a brilliant solution, but the goal was to use one and
only one function substituting xyz, but you've used three. This was my fault
since I couldn't describe the task correctly. English isn't my native
language and it was late in the evening... Let me try to rephrase the
question:
<?php
$i++;
if($i<=9)
xyz (__FILE__) ;
else
echo $i;
?>
Alter the code above so that the output is 10. Alter the code by replacing
xyz with a single function or construct call. Adding parameters or functions
is not allowed.
Perhaps this sets strict enough conditions for the puzzle. :)
--
Rami.Elomaa@gmail.com
"Good tea. Nice house." -- Worf
Navigation:
[Reply to this message]
|