-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
Of Pete
Sent: Monday, July 28, 2008 4:14 AM
To: [email protected]
Subject: Re: [php-list] explode function

In message <[EMAIL PROTECTED]>, Tedit kap
<[EMAIL PROTECTED]> 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


Reply via email to