is there a php editor of developer environment that asks for variables to be declared?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • lkrubner@geocities.com

    #1

    is there a php editor of developer environment that asks for variables to be declared?


    PHP does not ask developers to declare their variables. You can simply
    create a variable on the fly. That is nice for small scripts and a
    headache for large projects. Is there editor out there that enforces a
    kind of strict mode? I don't need full variable typing, I just want an
    editor that makes me declare all variable - at the very least I'd like
    to be able to catch spelling errors.

  • ZeldorBlat

    #2
    Re: is there a php editor of developer environment that asks for variables to be declared?

    If you crank up the error reporting level PHP will warn you about using
    a variable before it has been defined.



    You probably want E_ALL.

    Comment

    • lkrubner@geocities.com

      #3
      Re: is there a php editor of developer environment that asks for variables to be declared?


      ZeldorBlat wrote:[color=blue]
      > If you crank up the error reporting level PHP will warn you about using
      > a variable before it has been defined.
      >
      > http://www.php.net/manual/en/ref.err...rror-reporting
      >
      > You probably want E_ALL.[/color]

      Good to know. So if I set it to E_ALL, PHP will want me to write this
      line:

      var $myHtmlString = "";

      before I start using the variable $myHtmlString?

      Comment

      • R. Rajesh Jeba Anbiah

        #4
        Re: is there a php editor of developer environment that asks for variables to be declared?

        lkrubner@geocit ies.com wrote:[color=blue]
        > ZeldorBlat wrote:[color=green]
        > > If you crank up the error reporting level PHP will warn you about using
        > > a variable before it has been defined.
        > >
        > > http://www.php.net/manual/en/ref.err...rror-reporting
        > >
        > > You probably want E_ALL.[/color]
        >
        > Good to know. So if I set it to E_ALL, PHP will want me to write this
        > line:
        >
        > var $myHtmlString = "";
        >
        > before I start using the variable $myHtmlString?[/color]

        Probably you may not be wanted... But, anyway you can do such
        wonders if you use <http://in2.php.net/set_error_handl er>

        --
        <?php echo 'Just another PHP saint'; ?>
        Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/

        Comment

        • R. Rajesh Jeba Anbiah

          #5
          Re: is there a php editor of developer environment that asks for variables to be declared?

          R. Rajesh Jeba Anbiah wrote:[color=blue]
          > lkrubner@geocit ies.com wrote:[/color]
          <snip>[color=blue][color=green]
          > > Good to know. So if I set it to E_ALL, PHP will want me to write this
          > > line:
          > >
          > > var $myHtmlString = "";
          > >
          > > before I start using the variable $myHtmlString?[/color][/color]

          BTW, I don't think you need such feature. If you use a variable
          without having a value in it, it's an error; and you have to correct
          it. If you just want to fill it with empty text or null, as somone
          said, you set your error level to low.

          --
          <?php echo 'Just another PHP saint'; ?>
          Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/

          Comment

          • Raqueeb Hassan

            #6
            Re: is there a php editor of developer environment that asks for variables to be declared?

            You might try this one ...



            --
            Raqueeb Hassan
            Bangladesh

            Comment

            • lkrubner@geocities.com

              #7
              Re: is there a php editor of developer environment that asks for variables to be declared?

              > > Good to know. So if I set it to E_ALL, PHP will want me to[color=blue][color=green]
              >>write this
              > > line:
              > > var $myHtmlString = "";
              > > before I start using the variable $myHtmlString?[/color][/color]
              [color=blue]
              > BTW, I don't think you need such feature. If you use a variable
              > without having a value in it, it's an error; and you have to correct
              > it. If you just want to fill it with empty text or null, as somone
              > said, you set your error level to low.[/color]

              I'm not sure I understand you. I want to declare my variables before
              they are used. I'd like an IDE that enforces it. I might declare a
              variable like this:

              var $isFlagSet = false;

              and then later I might have an if() test like this:

              if ($ifFlagSet) {
              echo "success";
              } else {
              echo "sorry, there was an error";
              }

              Comment

              • rich@newsguy.com

                #8
                Re: is there a php editor of developer environment that asks for variables to be declared?

                In article <1129384888.748 848.184590@g47g 2000cwa.googleg roups.com>,
                lkrubner@geocit ies.com says...[color=blue]
                >
                >
                >PHP does not ask developers to declare their variables. You can simply
                >create a variable on the fly. That is nice for small scripts and a
                >headache for large projects. Is there editor out there that enforces a
                >kind of strict mode? I don't need full variable typing, I just want an
                >editor that makes me declare all variable - at the very least I'd like
                >to be able to catch spelling errors.
                >[/color]

                I wish PHP had the "use strict" mode that Perl has. I've gotten accustomed to
                weeding out typos and goofy errors that take a little longer to debug now. Maybe
                it was too much of a crutch. I still catch myself starting with "my $var =... ".
                Maybe there's a settings in the php.ini file to output more information to the
                web error log, but wasn't seeing anything obvious.

                Rich
                --
                Newsguy -- http://newsguy.com

                Comment

                • Roman Khutkyy

                  #9
                  Re: is there a php editor of developer environment that asks for variables to be declared?

                  On Wed, 26 Oct 2005 01:17:59 +0300, <rich@newsguy.c om> wrote:
                  [color=blue]
                  > In article <1129384888.748 848.184590@g47g 2000cwa.googleg roups.com>,
                  > lkrubner@geocit ies.com says...[color=green]
                  >>
                  >>
                  >> PHP does not ask developers to declare their variables. You can simply
                  >> create a variable on the fly. That is nice for small scripts and a
                  >> headache for large projects. Is there editor out there that enforces a
                  >> kind of strict mode? I don't need full variable typing, I just want an
                  >> editor that makes me declare all variable - at the very least I'd like
                  >> to be able to catch spelling errors.
                  >>[/color]
                  >
                  > I wish PHP had the "use strict" mode that Perl has. I've gotten
                  > accustomed to
                  > weeding out typos and goofy errors that take a little longer to debug
                  > now. Maybe
                  > it was too much of a crutch. I still catch myself starting with "my $var
                  > =... ".
                  > Maybe there's a settings in the php.ini file to output more information
                  > to the
                  > web error log, but wasn't seeing anything obvious.
                  >
                  > Rich
                  > --
                  > Newsguy -- http://newsguy.com
                  >[/color]

                  Free up then.
                  Give up with PHP.
                  Love Perl - us it. I hate PHP for such things too :)

                  --
                  Exact Meta Search

                  Comment

                  Working...