Question:

What is the systematic way to program in php?

by  |  earlier

0 LIKES UnLike

Plz any php guru tell me what is the systematic way to write program in php.I mean that suppose any client requirement

comes to me i write program in php(core php),then another

requirement comes to me on some other day i write program again. But solution and coding style for each requirement always differ.

Suggest me a reusable and systematic way

 Tags:

   Report

3 ANSWERS


  1. My best advice is to find a good book on programming paradigms and best practices. Hit your local library, I'm sure they will have something.

    The one I have recommended to various friends and it's very good for bringing a beginner PHP programmer up to speed is PHP Objects, Patterns, and Practice, from apress.


  2. For me, it always depends on the framework I'm using, like, if it's osCommerce, I try to follow the standards set in osCommerce, I'll put all text strings in language files the way osCommerce does and basically just try and mimic the framework.  PHPMyDirectory has it's own templating system so I try to utilize it.

    If you're creating your own framework, I would mimic whatever frameworks feel most comfortable.  I like to have a config.php file that will do all preprocessing and then have each page include the config.php file at the beginning.  I created my own templating system for my own framework, but I'm not going to try and integrate it if I'm working on a Joomla site, I'm going to use Joomla's templating system.

    I think the moral is, try not to throw off the logic of whatever framework you are working in and if you are creating from scratch, try and mimic a framework that has proven to be productive and try to be consistent.

    As for syntax, again, I just try to follow whatever syntax has been used in the framework.  If their foreach statements look like this:

    foreach($array as $element) {

    }

    I'll write mine like that, or if they look like this...

    foreach ( $array as $element )

    {

    }

    I'll write them like that even if I prefer the former...

    Not sure if this is the type of advice you were looking for but hope it helps anyhow.

  3. Just search on google, there are many tutorials:

    http://www.php.net

    http://www.w3schools.com

    search in google for "learn php" and "php tutorials" and pick all websites in the first page, and choose the most you like !

    You may also visit this blog:

    http://myphpsource.blogspot.com/

Question Stats

Latest activity: earlier.
This question has 3 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.
Unanswered Questions