When to make a class

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



My background is in Object Oriented Pascal (Delphi), however I am having difficulty knowing when to make a class in PHP. For instance, in my script file, functions.php, I have these functions among others:

  /* Input a field */
  function input_field($name, $value, $size, $max) {
    echo('<INPUT TYPE="text" NAME="' . $name . '" VALUE="' . $value .
         '" SIZE="' . $size . '" MAXLENGTH="' . $max . '">');
  };

  /* Input a password field */
  function input_password_field($name, $value, $size, $max) {
    echo('<INPUT TYPE="password" NAME="' . $name . '" VALUE="' . $value .
         '" SIZE="' . $size . '" MAXLENGTH="' . $max . '">');
  };


Should I have a class that contains these functions (methods)?

One of my non-profit clients would like to have an online emailer program driven by a MySQL database. This I can envision as a class, actually several classes (e.g. send mail, create message, select addresses, etc.).

Todd

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux