BUG IN PHP? (class member undefined)

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

    BUG IN PHP? (class member undefined)

    error_reporting (E_ALL);
    class cls{
    var $val;
    function cls(){
    $this->$val = 999;
    }
    }
    $c = new cls;

    With error_reporting set to E_ALL PHP floods me with notifications that
    class variables are undifined, whenever I try to use them. WTF???

  • no@email.com

    #2
    Re: BUG IN PHP? (class member undefined)

    $ sign is used for variables, not objects

    use
    $this->val = 999;

    not
    $this->$val = 999;

    Comment

    • Tamagafk

      #3
      Re: BUG IN PHP? (class member undefined)

      Thanks!
      Damn, I hate this crap called php language...

      Comment

      • Tony Marston

        #4
        Re: BUG IN PHP? (class member undefined)


        "Tamagafk" <tamagafk@gmail .comwrote in message
        news:1167301116 .705628.284350@ 79g2000cws.goog legroups.com...
        Thanks!
        Damn, I hate this crap called php language...
        >
        If you hate it so much then don't use it. If you HAVE to use it then do the
        intelligent thing and READ THE F*CKING MANUAL!!!! You will screw up in any
        language if you don't get the syntax right.

        --
        Tony Marston
        This is Tony Marston's web site, containing personal information plus pages devoted to the Uniface 4GL development language, XML and XSL, PHP and MySQL, and a bit of COBOL

        Build apps faster with Rapid Application Development using open-source RAD tools, modern RAD frameworks, and rapid application design methods.



        Comment

        • Peter van Schie

          #5
          Re: BUG IN PHP? (class member undefined)

          Tony Marston wrote:

          [snip]
          If you hate it so much then don't use it. If you HAVE to use it then do the
          intelligent thing and READ THE F*CKING MANUAL!!!! You will screw up in any
          language if you don't get the syntax right.
          Don't feed the troll, it's a waste of valuable time.

          Peter.

          Comment

          • Tamagafk

            #6
            Re: BUG IN PHP? (class member undefined)

            Pal, I don't have such problems in any other languages I know. Sytnax
            have to be logical. Programming in php is constant stumbling over its
            ugly syntax.

            """Tony Marston ÐÉÓÁÌ(Á):
            """
            "Tamagafk" <tamagafk@gmail .comwrote in message
            news:1167301116 .705628.284350@ 79g2000cws.goog legroups.com...
            Thanks!
            Damn, I hate this crap called php language...
            >
            If you hate it so much then don't use it. If you HAVE to use it then do the
            intelligent thing and READ THE F*CKING MANUAL!!!! You will screw up in any
            language if you don't get the syntax right.
            >
            --
            Tony Marston
            This is Tony Marston's web site, containing personal information plus pages devoted to the Uniface 4GL development language, XML and XSL, PHP and MySQL, and a bit of COBOL

            http://www.radicore.org

            Comment

            • Jerry Stuckle

              #7
              Re: BUG IN PHP? (class member undefined)

              Tamagafk wrote:
              """Tony Marston ÐÉÓÁÌ(Á):
              """
              >
              >>"Tamagafk" <tamagafk@gmail .comwrote in message
              >>news:11673011 16.705628.28435 0@79g2000cws.go oglegroups.com. ..
              >>
              >>>Thanks!
              >>>Damn, I hate this crap called php language...
              >>>
              >>
              >>If you hate it so much then don't use it. If you HAVE to use it then do the
              >>intelligent thing and READ THE F*CKING MANUAL!!!! You will screw up in any
              >>language if you don't get the syntax right.
              >>
              >>--
              >>Tony Marston
              >>http://www.tonymarston.net
              >>http://www.radicore.org
              >
              >
              Pal, I don't have such problems in any other languages I know. Sytnax
              have to be logical. Programming in php is constant stumbling over its
              ugly syntax.
              >
              (Top posting fixed)

              Pal, I don't have any problem with PHP syntax. I find it quite logical
              - more so than at least half of the 15-20 languages I've used over the
              years.

              As Tony said - if you hate it so much, don't use it. There are many
              other languages out there which can do what you want. Or at least RTFM.

              And please don't top post.

              --
              =============== ===
              Remove the "x" from my email address
              Jerry Stuckle
              JDS Computer Training Corp.
              jstucklex@attgl obal.net
              =============== ===

              Comment

              • Michael Fesser

                #8
                Re: BUG IN PHP? (class member undefined)

                ..oO(Tamagafk)
                >Pal, I don't have such problems in any other languages I know. Sytnax
                >have to be logical.
                PHP's syntax is quite logical and reasonable. Both

                $obj->var
                $obj->$var

                are completely different things. If you don't understand them, improve
                your knowledge by reading the manual instead of complaining about "ugly
                syntax".

                Micha

                Comment

                Working...