>php values.php
When I run the above line i get the error message as follows:
X-Powered-By: PHP/4.0.2
Content-type: text/html
<br>
<b>Warning</b>: Undefined offset: 1 in <b>/home/httpd/html/main.inc</b> on line <b>37</b><br>
I'm using RH6.2, PHP/4.0.2, MySQL 3.22.30, Apache 1.3.12
Any clues would be greatly appreciated, or just a prod in the right direction.
I know that if I remove the bars from that line in main.inc it doesn't have this problem, but I may be breaking something else. Thank You.
Jan G.
gannon@cyberdawgs.com
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2000-09-21
Correction, I'm removing the bars from the Split Function above this particular line 37.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Here is the longer explanation. Looking at:
$split = preg_split ("|/|",preg_replace("|^http(.*)://|", "", $hostname), 2);
the "|/|", is just matching the '/' character to split around. The same is true for the |^http(.*)://|. The convention is to use "/pattern/" instead of "|pattern|". But if I were to use /pattern/, with a '/' begin in the pattern, I would have to do this: '/\//' and '/^http(.*):\/\//', which is a bit less appealing. However, its a small change, and I'll make it. This must have been a change in the recent PHP 4.0.x series, because the documentation is still behind. Included below is part of the section from the PHP manual dealing with PCRE (Perl Compatible Regular Expressions).
The syntax for patterns used in these functions closely resembles Perl. The expression should be enclosed in the delimiters, a forward slash (/), for example.
Any character can be used for delimiter as long as it's not alphanumeric or backslash (\). If the delimiter character has to be used in the expression itself, it needs to be escaped by backslash.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
>php values.php
When I run the above line i get the error message as follows:
X-Powered-By: PHP/4.0.2
Content-type: text/html
<br>
<b>Warning</b>: Undefined offset: 1 in <b>/home/httpd/html/main.inc</b> on line <b>37</b><br>
I'm using RH6.2, PHP/4.0.2, MySQL 3.22.30, Apache 1.3.12
Any clues would be greatly appreciated, or just a prod in the right direction.
I know that if I remove the bars from that line in main.inc it doesn't have this problem, but I may be breaking something else. Thank You.
Jan G.
gannon@cyberdawgs.com
Correction, I'm removing the bars from the Split Function above this particular line 37.
Quick fix:
$split = preg_split ("/\//",preg_replace("/^http(.*):\/\//", "", $hostname), 2);
Here is the longer explanation. Looking at:
$split = preg_split ("|/|",preg_replace("|^http(.*)://|", "", $hostname), 2);
the "|/|", is just matching the '/' character to split around. The same is true for the |^http(.*)://|. The convention is to use "/pattern/" instead of "|pattern|". But if I were to use /pattern/, with a '/' begin in the pattern, I would have to do this: '/\//' and '/^http(.*):\/\//', which is a bit less appealing. However, its a small change, and I'll make it. This must have been a change in the recent PHP 4.0.x series, because the documentation is still behind. Included below is part of the section from the PHP manual dealing with PCRE (Perl Compatible Regular Expressions).
LIV. Regular Expression Functions (Perl-Compatible)
The syntax for patterns used in these functions closely resembles Perl. The expression should be enclosed in the delimiters, a forward slash (/), for example.
Any character can be used for delimiter as long as it's not alphanumeric or backslash (\). If the delimiter character has to be used in the expression itself, it needs to be escaped by backslash.