|
Posted by BootNic on 06/22/07 03:59
> Neredbojias <neredbojias@gmail.com> wrote:
> news: Xns9956C5BC4E732nanopandaneredbojias@198.186.190.161
> On Thu, 21 Jun 2007 14:30:49 GMT rf scribed:
[snip]
>> $page =
>> array_shift(explode('.',array_pop(explode('/',$_SERVER['PHP_SELF']))));
>
> Uh, who do you think I am, -Einstein?
> I'd take it kindly if you'd please explain the above in detail so my
> headache would go away and I could get back to watching those reruns
> of "The Three Stooges" I enjoy so much...
[snip]
Work the statement from right to left.
Server variables: $_SERVER['PHP_SELF']
The filename of the currently executing script, relative to the document
root. For instance, $_SERVER['PHP_SELF'] in a script at the address
http://example.com/test.php/foo.bar would be /test.php/foo.bar.
explode('/',$_SERVER['PHP_SELF'])
explode Split a string by string returns an array of strings
returns array('temp','mydri','index.php')
array_pop(explode('/',$_SERVER['PHP_SELF']))
array_pop() pops and returns the last value of the array...
returns 'index.php'
explode('.',array_pop(explode('/',$_SERVER['PHP_SELF'])))
explode Split a string by string returns an array of strings
returns array('index','php')
array_shift(explode('.',array_pop(explode('/',$_SERVER['PHP_SELF']))))
array_shift() shifts the first value of the array off and returns it...
returns 'index'
--
BootNic Thursday, June 21, 2007 11:58 PM
Our earth is degenerate in these latter days; bribery and corruption
are common; children no longer obey their parents; and the end of the
world is evidently approaching.
*Assyrian clay tablet 2800 B.C.*
[Back to original message]
|