|
Posted by Steve on 04/18/07 13:34
"Toby A Inkster" <usenet200703@tobyinkster.co.uk> wrote in message
news:qgtgf4-9qv.ln1@ophelia.g5n.co.uk...
| tasteless wrote:
|
| > I need really hard questions (about 10) about PHP programming (some of
| > elements OOP as well, but no MySQL questions - this is different part),
| > this questions needs to be very hard, but the experienced senior PHP
| > developer should answered on it.
|
| Question 1:
|
| <?php
| $i = 5;
| $i = 5 + $i++;
| echo $i; // What does this print?
| ?>
i see you've taken the $i = $i + $i++ discussion here. you do realize this
effects ALL c-ish languages including javascript, right? :)
since he's betting his 'c' developers, they'll laugh that he thinks it is an
advanced question.
| Question 2:
|
| Which of the following is wrong? (There may be more than one
| which are wrong.)
|
| * in_array($needle, $haystack);
| * stristr($needle, $haystack);
| * strpos($needle, $haystack);
| * preg_match($needle, $haystack);
NONE of the above are wrong. you fail to make constraints on $needle and
$haystack in each function. so as long as the parameter count is correct, i
can imagine each variable has the correct value for making each function run
smoothly. you should start by setting an initial value for $needle and
$haystack before the application of each function. this is not very advanced
either.
| Question 3:
|
| Describe the output of this code:
|
| <?php
| function print_defined_vars ()
| {
| print_r(get_defined_vars());
| }
| $a = 1;
| $b = 2;
| print_defined_vars();
| ?>
uhmmm, is this a head-scratcher? it's all about scope...and this one has
none defined. better than the last two questions though. ;^)
cheers
[Back to original message]
|