Undefined Class Constant using PHP version 5 - Help

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Phil Powell

    #1

    Undefined Class Constant using PHP version 5 - Help

    [PHP]
    class NicknameVerifie r {

    function NicknameVerifie r() {}

    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.ph p 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.ph p equally. Why am I getting an "undefined class
    constant" error, it's right there?!

    Thanx
    Phil
  • Chung Leong

    #2
    Re: Undefined Class Constant using PHP version 5 - Help


    Uzytkownik "Phil Powell" <soazine@erols. com> napisal w wiadomosci
    news:1cdca2a7.0 403112225.4e960 796@posting.goo gle.com...[color=blue]
    > class HTMLRetriever {
    >
    > var $MAX_URL_SIZE = 100000;
    >
    > }[/color]

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



    Comment

    • Pedro Graca

      #3
      Re: Undefined Class Constant using PHP version 5 - Help

      Chung Leong wrote:[color=blue]
      >
      > Uzytkownik "Phil Powell" <soazine@erols. com> napisal w wiadomosci
      > news:1cdca2a7.0 403112225.4e960 796@posting.goo gle.com...[color=green]
      >> class HTMLRetriever {
      >>
      >> var $MAX_URL_SIZE = 100000;
      >>
      >> }[/color]
      >
      > var $MAX_URL_SIZE =100000; => a variable
      > const MAX_URL_SIZE = 100000; => a constant[/color]

      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 =--

      Comment

      • StarEvil

        #4
        Re: Undefined Class Constant using PHP version 5 - Help

        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


        Comment

        Working...