Hi, Do you happen to know the exact different between $_SERVER['SCRIPT_NAME'] and $_SERVER['PHP_SELF']?
I usually use $_SERVER['PHP_SELF'] to get the result like what $_SERVER['SCRIPT_NAME'] produces. I just don't know if they are actually different in use. Someone can explain about this. :) Regards, Martin On Mon, Jul 28, 2008 at 7:57 AM, Jenny Connors <[EMAIL PROTECTED]>wrote: > > -----Original Message----- > From: [email protected] <php-list%40yahoogroups.com> [mailto: > [email protected] <php-list%40yahoogroups.com>] On Behalf > Of Pete > Sent: Monday, July 28, 2008 4:14 AM > To: [email protected] <php-list%40yahoogroups.com> > Subject: Re: [php-list] explode function > > In message <[EMAIL PROTECTED]<233874.48512.qm%40web36303.mail.mud.yahoo.com>>, > Tedit kap > <[EMAIL PROTECTED] <teditkap%40yahoo.com>> writes > >Hi, > >The code below, first I get the path of the current page i.e. > >/home/subpage1/subpage1.php etc... Then I am trying to explode $a, so > >that I will have the hom, subpage and subpage1a.php words separately. I > >read that explode function creates an array such as $aa[0] and > >$aa[1]...But the problem below is I can not see these in the output. > >This echo statement outputs nothing. > >What is the problem below? > >$a= $_SERVER['PHP_SELF' ]; > >$aa=explode("/", $a); > >echo $aa[0].$aa[1]; > > No problems there except that [0] will be empty, as the string contains > nothing before the first '/': > : array = > 0: string = "" > 1: string = "home" > 2: string = "subpage1" > 3: string = "subpage1.php" > > Are you sure that you have something in $_SERVER['PHP_SELF' ]? > > I seem to recall that older versions of PHP had different variable names. > > -- > Pete Clark > > Sunny Andalucia > http://hotcosta.com/Andalucia.Spain > > ------------------------------------ > > Try $_SERVER["SCRIPT_NAME"]. Also, put something after your echo so you > know for sure if something's in the variable or not. > > echo $_SERVER["SCRIPT_NAME"].' is _SERVER SCRIPT_NAME<br />'; > > HTH, Jenny > > ~~~~~~~~~~~~~~~ > Jenny Connors > WhiteWaveDesigns.com > 215 Essex Avenue > Gloucester MA 01930 > h: 978-281-0472 > c: 978-290-3968 > > > [Non-text portions of this message have been removed]
