[PHP] preg_replace("/^\//".. doesnt work?
Im having a weird regexp problem in PHP that I think is correct but it doesnt appear to work. The code is this: $a = "/test/"; preg_replace("/^\//", "", $a); echo $a; I want preg_replace to replace the first '/' in $a with '' so that the echo function echoes "test/", but instead it echoes "/test/" as if preg_replace didnt worked? What am I doing wrong? Im using: PHP Version 4.1.1 Configure Command: './configure' '--with-mysql=/usr/local/mysql' '--with-apxs=/usr/local/apache/bin/apxs' '--with-db2--disable-debug' '--disable-static' '--enable-sockets' '--with-yp' '--with-zlib' Regex Library: Bundled library enabled PCRE (Perl Compatible Regular Expressions) Support: enabled PCRE Library Version: 3.4 22-Aug-2000 Please CC me since Im not a member of this maillinglist. -- * John Ericson [EMAIL PROTECTED] * ICQ: 7325429 JID: [EMAIL PROTECTED] * web: http://john.pp.se -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: preg_replace("/^\//".. doesnt work?
thanks! On Feb 20 11:55, Philip Hallstrom wrote: >$a = "/test/"; >$a = preg_replace("/^\//", "", $a); >echo $a; > > Notice the difference in the second line... > > On Wed, 20 Feb 2002, John Ericson wrote: > > > Im having a weird regexp problem in PHP that I think is correct but it > > doesnt appear to work. > > > > The code is this: > > > > $a = "/test/"; > > preg_replace("/^\//", "", $a); > > echo $a; > > > > I want preg_replace to replace the first '/' in $a with '' so that the > > echo function echoes "test/", but instead it echoes "/test/" as if > > preg_replace didnt worked? What am I doing wrong? > > > > Im using: > > PHP Version 4.1.1 > > Configure Command: './configure' '--with-mysql=/usr/local/mysql' > > '--with-apxs=/usr/local/apache/bin/apxs' '--with-db2--disable-debug' > > '--disable-static' '--enable-sockets' '--with-yp' '--with-zlib' > > Regex Library: Bundled library enabled > > PCRE (Perl Compatible Regular Expressions) Support: enabled > > PCRE Library Version: 3.4 22-Aug-2000 > > > > > > Please CC me since Im not a member of this maillinglist. > > > > -- > > * John Ericson [EMAIL PROTECTED] > > * ICQ: 7325429 JID: [EMAIL PROTECTED] > > * web: http://john.pp.se > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > -- * John Ericson [EMAIL PROTECTED] * ICQ: 7325429 JID: [EMAIL PROTECTED] * web: http://john.pp.se -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] get the filename of an include'd/require'd file?
Anyone knows how I can get the name of an include'd/require'd file and not getting the name of the main file. My scenario is like this: a.php: require "b.php"; b.php: echo $_SERVER['PHP_SELF']; echo $_SERVER['SCRIPT_NAME']; I get a.php when I want to have b.php. (Please CC me since Im not a member of the list) -- * John Ericson [EMAIL PROTECTED] * ICQ: 7325429 JID: [EMAIL PROTECTED] * web: http://john.pp.se -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] sometimes browser just recieves half the page
Im programming a page where I have a java-tree-menu that gets generated from a db. The code works perfectly but sometimes when a browser reads the page I just get half of the page. I have noticed this behaivour on many different browsers such as mozilla, netscape, galeon, explorer and even wget sometimes. The page is here so you can try it yourself (Its a frameset page actually, the page with the problem is to the left): http://www.rskhq.2y.net/~nacka/ The actual php page that has the problem is: http://www.rskhq.2y.net/~nacka/vr_navbar.php I suspect it is some problem with the configuration of apache or php but I dont know where to start looking. Versions: PHP 4.1.1 (See http://www.rskhq.2y.net/~nacka/phpinfo.php) Apache/1.3.22 (Unix) Please CC me since Im not a member of this maillinglist. -- * John Ericson [EMAIL PROTECTED] * ICQ: 7325429 JID: [EMAIL PROTECTED] * web: http://john.pp.se -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php