473,378 Members | 1,577 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Undefined Class Constant using PHP version 5 - Help

[PHP]
class NicknameVerifier {

function NicknameVerifier() {}

function isValid() {
if ($fileID) {
$content = fread($fileID, HTMLRetriever::MAX_URL_SIZE);
fclose($fileID);
if ($content) $this->setErrorArray(array('nickname' =>
$content)); // DUP NICKNAME FOUND
return false;
}
}
}

}
[/PHP]

Also consider:

[PHP]

class HTMLRetriever {

var $MAX_URL_SIZE = 100000;

}
[/PHP]

Upon the line:
[PHP]$content = fread($fileID, HTMLRetriever::MAX_URL_SIZE);[/PHP]

I get the following error:

Fatal error: Undefined class constant 'MAX_URL_SIZE' in
/wwwroot/mycgiserver.com/members/includes/chat_classes.php on line 230
I am using PHP version 5 at www.myjavaserver.com and I am completely
at a loss as to what is going on. Both classes reside in
chat_classes.php equally. Why am I getting an "undefined class
constant" error, it's right there?!

Thanx
Phil
Jul 17 '05 #1
3 17281

Uzytkownik "Phil Powell" <so*****@erols.com> napisal w wiadomosci
news:1c**************************@posting.google.c om...
class HTMLRetriever {

var $MAX_URL_SIZE = 100000;

}


var $MAX_URL_SIZE =100000; => a variable
const MAX_URL_SIZE = 100000; => a constant

Jul 17 '05 #2
Chung Leong wrote:

Uzytkownik "Phil Powell" <so*****@erols.com> napisal w wiadomosci
news:1c**************************@posting.google.c om...
class HTMLRetriever {

var $MAX_URL_SIZE = 100000;

}


var $MAX_URL_SIZE =100000; => a variable
const MAX_URL_SIZE = 100000; => a constant


and their use is different!

variables belong to instances of classes
constants belong to the class itself

$x = new HTMLRetriever();

echo $x->MAX_URL_SIZE; // instance variable
echo HTMLRetriever::MAX_URL_SIZE; // class constant
--
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =--
Jul 17 '05 #3
PHP5 is a BETA version. And have to many bugs( i have tested it). I have
advise not to use it(

--
Started at суббота, Март 13, 2004
Up for 0 days, 4 hours, 19 minutes, 41 seconds
CPUSpeed at now: 1003,67 MHz
Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jochen Daum | last post by:
Hi, according to php.net, I should use CURLOPT_HTTPPOST to upload a file with cURL. When I use it I get 'undefined constant'? My php is compiled with curllib 7.11.2 help anyone? Jochen
3
by: bp | last post by:
Hi, Could someone to tell me what I'm doing wrong? I'm using gcc version 3.3.4 and ld version 2.15.90.0.3 20040415 the linker message is: .../obj/classOpenAreaForm.o(.text+0x211): In...
10
by: Not Available | last post by:
On the host server: namespace JCart.Common public class JCartConfiguration : IConfigurationSectionHandler private static String dbConnectionString; public static String ConnectionString { get...
29
by: Michael D. Ober | last post by:
Is there any way to create a constant in a class that can be used both with an instantiated object and without. For example: dim ClassConst as string = myClass.ConstantString dim myObj = new...
2
by: thuythu | last post by:
Please help me.... I used and Javascript to view the data. But when i click button open a popup windows, then select data and click save button. The popup close and return the main page, but the...
10
by: subramanian100in | last post by:
Consider the following code: #include <iostream> #include <cstdlib> using namespace std; int main() { const double& ref = 100;
12
by: hweekuan | last post by:
hi, it seems i can't assign the const variable u in class A, one way to solve the problem may be to build a copy constructor. however, why does C++ or vector class not like this code? my g++ is:...
4
by: xiaoxiaoyang | last post by:
Hi, I have a variable, previously was a constant, and defined in a header file, e.g., A.h, and then now I would like to change this variable as can be specified from a parameter file, such as...
22
by: blargg | last post by:
Does ~0 yield undefined behavior? C++03 section 5 paragraph 5 seems to suggest so: The description of unary ~ (C++03 section 5.3.1 paragraph 8): But perhaps "one's complement" means the...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.