SitePoint Sponsor |
|
User Tag List
Results 201 to 219 of 219
Thread: PHP Quiz
-
Jun 23, 2003, 07:15 #201
- Join Date
- Nov 2001
- Location
- Atlanta, GA, USA
- Posts
- 5,011
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by cyborg from dh
Ok, I forgot about the freaking C constant.
PHP Code:define('S' . strtoupper(str_rot13(f)), 'c', 0);
/*
01234567890123
fghijklmnopqrs
strtoupper to S
SS, 'c', 0
*/
Originally Posted by cyborg from dh
Using your unpaid time to add free content to SitePoint Pty Ltd's portfolio?
-
Jun 23, 2003, 07:29 #202
- Join Date
- Nov 2001
- Location
- Atlanta, GA, USA
- Posts
- 5,011
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Still don't see the mistake. Oh well.
PHP Code:define('C', 'f');
define('SS', 'c', 0);
$d = '2.';
$q = 'S';
// list ($x, $y) = array('p', 'gg');
$x = 'p';
$y = 'gg';
// $b = substr(str_rot13('a'.$x.'xy'.$y), 1, -4);
/*
apxygg == 'a'.$x.'xy'.$y
nckltt == str_rot13('apxygg')
(there's a table on the php.net str_rot13
man page that helps with these)
$b = 'c' == substr('nckltt', 1, -4)
*/
$e = 'a';
$f = 63;
$c = 'a' . 12.5 . 63;
${'a1'.${((${'h'} = SS) ? ++$h : 0)}.'5'.(($g = 126 / 5) + ($g * 1.5))} = (float) ($d . ($f * 1.9047619047619));
$a = ${${$b}};
ob_start();
var_dump(${$e});
eval('${S'.$q.'} = substr(strrchr(ob_get_contents(), substr(\'(\',0)), 1, -(int) substr($c, 2, -2)) . round(floor($$b));');
ob_end_clean();
echo $$b;
Last edited by samsm; Jun 23, 2003 at 11:13.
Using your unpaid time to add free content to SitePoint Pty Ltd's portfolio?
-
Jun 23, 2003, 10:33 #203
- Join Date
- Jan 2003
- Location
- Calgary, Canada
- Posts
- 2,063
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
$c = ($e = 'a') . (25 / 2) . ($f = 22 | 45);
how are you getting $c = 1 ....Who walks the stairs without a care
It shoots so high in the sky.
Bounce up and down just like a clown.
Everyone knows its Slinky.
-
Jun 23, 2003, 11:17 #204
- Join Date
- Nov 2001
- Location
- Atlanta, GA, USA
- Posts
- 5,011
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I don't know why but I was thinking that an assignment would return 1 upon success. Doesn't make much sense upon reflection. Fixed it now, in the code above.
Using your unpaid time to add free content to SitePoint Pty Ltd's portfolio?
-
Jun 25, 2003, 06:24 #205
- Join Date
- Aug 2001
- Location
- Amsterdam
- Posts
- 788
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Since nobody is asking and I have a problem I can't seem to fix easily... I wanted to ask you guru types this:
I want to know at the bottom of my pages how long php took to parse ...
How do I do this with as little code possible???the neigbours (free) WIFI makes it just a little more fun
-
Jun 25, 2003, 06:39 #206
- Join Date
- Jun 2001
- Location
- Before These Crowded Streets
- Posts
- 9,446
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
PHP Code:<?php
//at top of page
$start = microtime();
.
.
.
//at end of page
$end = microtime();
$timeelapsed = date('i:s',($end - $start));
?>
-
Jun 25, 2003, 07:38 #207
- Join Date
- Jan 2003
- Location
- Calgary, Canada
- Posts
- 2,063
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Just a note, someone has to answer the last question before a new question can be asked, but we'll let you off this time
Who walks the stairs without a care
It shoots so high in the sky.
Bounce up and down just like a clown.
Everyone knows its Slinky.
-
Jun 25, 2003, 07:41 #208
- Join Date
- Jun 2001
- Location
- Before These Crowded Streets
- Posts
- 9,446
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
sorry...thought it was already answered.
-
Jun 25, 2003, 07:43 #209
- Join Date
- Jan 2003
- Location
- Calgary, Canada
- Posts
- 2,063
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
yeah that was supposed to be quoting the person who posted the question, not you, but whatever, lol, forgot to check the 'Quote Message in Reply?' checkbox.
Who walks the stairs without a care
It shoots so high in the sky.
Bounce up and down just like a clown.
Everyone knows its Slinky.
-
Jun 25, 2003, 07:51 #210
- Join Date
- Aug 2001
- Location
- Amsterdam
- Posts
- 788
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by cyborg from dh
Just shows I do find it interesting but It's out of my leage [img]images/smilies/rolleyes.gif[/img]the neigbours (free) WIFI makes it just a little more fun
-
Jun 26, 2003, 05:33 #211
- Join Date
- Jun 2003
- Location
- Elsewhere
- Posts
- 107
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I spent some time on the previous question (I thought it should be possible to find an easy solution using serialization and/or regex's). After a while I noticed you don't need to array_flip() function...
PHP Code:foreach(array_reverse(array('Apple'=>'Jobs','Microsoft'=>'Gates','Oracle'=>'Ellison','Sun'=>'McNealy'))as$k=>$c)$n[strtolower(strrev($c))]=strtolower(strrev($k));
PHP Code:for($s=array('Apple'=>'Jobs','Microsoft'=>'Gates','Oracle'=>'Ellison','Sun'=>'McNealy');$k=end($s);array_pop($s))$n[strtolower(strrev($k))]=strtolower(strrev(key($s)));
-
Jun 26, 2003, 08:43 #212
- Join Date
- Nov 2001
- Location
- Atlanta, GA, USA
- Posts
- 5,011
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by Azmo
I'm lacking ambition.
Good modification of the Apple=> Jobs puzzle, by the way.
Post another puzzle when you post the cyborg solution!Using your unpaid time to add free content to SitePoint Pty Ltd's portfolio?
-
Jun 26, 2003, 14:00 #213
- Join Date
- Jun 2003
- Location
- Elsewhere
- Posts
- 107
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Well, here it is...
/*** CODE ***/ == original code
// COMMENT == refactoring
PHP Code:define('C', 'f');
/*** define('S' . strtoupper(str_rot13(C)), 'c', 0); ***/
// str_rot13(C) == str_rot13('f') == 's'
// strtoupper('s') == 'S'
define('SS', 'c', 0);
$d = '2.';
$q = 'S';
/*** list ($x, $y) = array('p', 'gg'); ***/
$x = 'p';
$y = 'gg';
/*** $b = substr(str_rot13('a'.$x.'xy'.$y), 1, -4); ***/
// str_rot13('apxygg') == 'nckltt'
// substr('nckltt', 1, -4) == 'c'
$b = 'c';
/*** $c = ($e = 'a') . (25 / 2) . ($f = 22 | 45); ***/
// 22 | 45 == 63
$e = 'a';
$c = 'a12.563';
/*** ${'a1'.${((${'h'} = SS) ? ++$h : 0)}.'5'.(($g = 126 / 5) + ($g * 1.5))} = (float) ($d . ($f * 1.9047619047619)); ***/
// ((${'h'} = SS) ? ++$h : 0)
// $h = SS returns 'c', which isn't FALSE, so we increment $h by one, making it 'd'.
// Using ++$h means the if statement returns 'd', not 'c'.
$h = 'd';
// (($g = 126 / 5) + ($g * 1.5)) == 25.2 + 37.8 == 63
// ${'a1'.${'d'}.'5'. 63} == $a12.563
// $d . ($f * 1.9047619047619) == '2.' . 120 == '2.120'
// (float) 2.120 == (float) 2.12
$g = 25.2;
${'a12.563'} = (float) 2.12;
/*** $a = ${${$b}}; ***/
// ${$b} == $c
// ${$c} == ${'a12.563'}
$a = ${'a12.563'};
ob_start();
/*** var_dump(${$e}); ***/
// ${$e} == $a
var_dump($a); // Stores "float(2.12) " in the output buffer (note the ending space).
/*** eval('${S'.$q.'} = substr(strrchr(ob_get_contents(), substr(\'(\',0)), 1, -(int) substr($c, 2, -2)) . round(floor($$b));'); ***/
// '${S'.$q.'}' == '${SS}' == '$c'
// ob_get_contents() == "float(2.12) "
// 'substr(\'(\',0)' == '\'('\'
// 'strrchr("float(2.12) ", \'(\' )' == '"(2.12) "'
// '-(int) substr($c, 2, -2)' == '-(int) substr("a12.563", 2, -2 )' == '-2'
// 'round(floor($$b))' == 'round(floor($c))' == 'round(floor("a12.563"))' == '"0"'
eval('$c = substr("(2.12) ", 1, -2) . "0";');
ob_end_clean(); // Discards the output buffer's contents.
/*** echo $$b; ***/
echo $c;
Someone else can post the next question, I'm all done PHPing for a while.
-
Jun 26, 2003, 18:51 #214
- Join Date
- Jan 2003
- Location
- Calgary, Canada
- Posts
- 2,063
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Good work
Who walks the stairs without a care
It shoots so high in the sky.
Bounce up and down just like a clown.
Everyone knows its Slinky.
-
Jun 14, 2004, 04:15 #215
- Join Date
- Oct 2001
- Location
- romania
- Posts
- 44
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
php quizzes?
Does anyone know where i could find php quizzes and/or tests?
I must hire a php programmer and i want to give some written tests...
Thx.you'll never be what you desire
-
Apr 3, 2006, 11:25 #216
This is a great thread.
I am bumping this because i think it is an excellent thread. Just reading the first 4 pages of it has provided me with ideas and concepts I wan't even aware of.
Good stuff!]
-
Jan 17, 2007, 00:03 #217
didnt understand :(
Salam to all
<?php
$i = 'Z';
echo ++$i;
?>
regarding above example ... i am little confused ... wht result is AA
if there is value
$i = 'Y';
then result will be Z not ZZ ??
may be its simple but i didnt understand it ??
Any help ???
Reagrds
-
Jan 17, 2007, 01:05 #218
- Join Date
- Dec 2006
- Location
- /dev/swat
- Posts
- 619
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
W Salam sumaira120
As to think on ur question i am also confused.
but one thing in my mind that loop or incremented z runs two times
to ending the alphabathic series then jump to single A..
This is my assupmtion may be some people not agree or may i am
wrong.
Thanks
ARIF.
-
Jan 17, 2007, 06:25 #219
Bookmarks