Talk:PHP Programming

Front Page Cleanup
I think the front page needs to be cleaned up a little. The top sections are good along with the contents of 'The Basics' section but further down it gets a little disorganised. It needs to be cleaned up and filled in to make the front page more presentable. Also, do we really need a 'Contributors' section? I thought the point of Wikis was that everyone contributed, it seems against the ethos to attribute certain pages to certain people. Fyorl (talk) 11:37, 13 February 2008 (UTC)

Working with Files
I plan on adding a section related to working with files. I will discuss mainly the use of the f(open|write|close) in conjunction with file and file_get_contents as well as devoting a small section to file_put_contents and how to emulate it with PHP 4.

I'm just checking that nobody is already working on a similar section. If I hear no response in a couple of days I will start work on the article on my Talk page and then tranfer it over upon completion.

The article will also make a reference to serialization. Since this could appear in both the Database section and the Session section, I was wondering if it was best to create a separate page and link to it from within all the other pages? Fyorl (talk) 16:52, 9 February 2008 (UTC)

Naming policy?
I am not new to Wikipedia, but this is the first time I have looked at a Wikibook. I have some confusion about the template that says the book's title does not adhere to the "naming policy." What is wrong with the title, and how does it not adhere? Here I have seen discussions about the book's content, cover, PHP version, and so forth, but nothing regarding the name or that template. To anyone that may advise--thanks. 67.42.14.57 18:19, 4 December 2007 (UTC)


 * If you click on the link in the naming policy notice, you'll see the preferred naming convention. This wikibook used to use a colon  separator for sub pages, which resulted in the need to manually link to the index (example: hello world).  Currently, the barely-existing PEAR page seems to be the only page still using the depricated naming convention.  --banzaimonkey (talk) 20:28, 10 December 2007 (UTC)


 * As it seems that all of the pages are in order (excepting PEAR), I removed the template. --banzaimonkey (talk) 20:33, 10 December 2007 (UTC)


 * But now it is back; anyone care to explain? &mdash; Sam Wilson (Australia) 21:36, 4 June 2008 (UTC)

Version
Are we talking PHP version 4 or 5 here?

PHP5 was recently released, and features the ZEND II engine, which includes enhanced OOP(Object Oriented Programming) features, better XML support, and built in SQLite support.

PHP4, on the other hand, is still the prevalant web technology, and I suspect that most servers will not be offering PHP5 support for some time.

Either way, I suggest that OOP be included in the 'advanced php' section. I just don't know how to write it because of the discrepancies between php4 and php5. --Noah 20:19, 28 Jul 2004 (UTC)

Ok, since I recieved no response, I will assume that this page is geared towards PHP5. I am going to start writing the OOP features accordingly. I will also edit the intro to make this obvious. --Noah 18:46, 14 Aug 2004 (UTC)

I think for anything specific to one version, we should show the equivalent in the older / newer version if possible. --Spoom 01:47, 7 Sep 2004 (UTC)


 * I'd like to second this notion, and extend it. Whenever possible I think functions that are aviable in both versions should be used. For most of the introductory material it doesn't matter.  OOP can be part of a later discussion, along with other major version 5 improvements.  Since these books are perminant static things we can always drop discussion of version 5 when it becomes the standard (in other words we can stop singling out the difference at that point).  I would expect most people learn PHP at the moment are still working in 4. --Ahc 06:28, 2 Dec 2004 (UTC)

External links?
There are many "dead" links here to pages that don't exist on wikibooks, and will most likely never exist. For example: GUI or Rasmus Lardorf will most likely not get their own books. It's much more likely that they'll get a Wikipedia page(GUI already has one), and I think that's where those links should take you...

I'd say change them to link to Wikipedia if you find them then, just use common sense. --Spoom 06:15, 6 Oct 2004 (UTC)

Learn PHP

Smarty Templates
There is no reason to discuss Smarty Templates as part of the language. You can either hit them in a round about PEAR and Templating or put the package in a list of "useful" PHP projects.
 * While Smarty is not part of the core language, it is mentioned in many other PHP books, and it is a very useful to have knowledge of its features. However, I think merging Templates and Smarty would be useful.

Include/Require functions
There seem to be at least 3 sections which talk about require(_once) and include(_once) (Headers and footers, Template and Including Files. Since these deal with basically the same subject, couldn't they be merged into a single page about the use of require and include, and a list/example of the uses of these functions? -- DorianGray

If I don't see any reasons why in the next few days I'll delete Templates and Headers and Footers and move all relevant content to Including Files. --DorianGray 06:58, 15 Nov 2004 (UTC)

Internal Functions?
I know that the PHP website has a lot of information about PHP's internal functions, but do we want to start highlighting the ones most used? I'm particularly interested in the mail function myself.

 I would say that's unnecessary, unless it comes up in the course of a lesson. I feel that a structured, lesson based approached would be better. Example: a lesson on "Sending E-Mail with PHP" rather than "mail", and "Working with Arrays" as opposed to "Array functions" or "array_sort" 

MySQL in PHP5
Should it be mentioned that PHP5 on Windows no longer has MySQL support built in, but has it shipped as a separate DLL that needs to be referenced in php.ini?

Hi, i think that this should be mentioned in the php:mysql page, not the main page. I wrote that it should be downloaded separately -- User:Wykis

Sub-pages
 Shouldn't the pages for setting up your environment be on subpages? It makes this main page seem awfully noisy to have them right there. 


 *  I agree, I think there seems to be alot of emphasis on lesser PHP topics such as setup, templating etc. and there should be more PHP code and the setup stuff should be in a sub-topic

Accessing files
I'd like to see a section on reading and writing from/to files. Anyone? Thanks!
 * I'm writing it now if no-one has any objections. I plan to put it in the basic section as a starter's guide to file manipulation.--Davidd 23:09, 11 December 2005 (UTC)

echo/print functions/constructs
On the Hello World page, and maybe in other places that I haven't noticed yet, echo and print are referred to as functions. Since they are actually language constructs in their own right, should they be more accurately referred to simply as statements?

The newline "operator"
 In PHP Basics Example #1: Basic Arithmetic Operators, a reference is made to a newline "operator". The example in question is actually referring to the process of adding a newline by using the \n escape sequence in a double quoted string. I recommend that firstly this reference is clarified, explaining escape characters, and that secondly, since PHP is most often used with HTML, that this example be rewritten to use the &lt;br /&gt; tag- it being the case that in a browser, the \n character does not cause a newline. 

I've got to agree on this too. This is so annoying when user changes the page to rendered html page. for example, text to text and to new line... We are not evaluating html here. HTML is just an example. Please don't edit any pages just to do that. Thank You Wykis 07:03, 26 March 2006 (UTC)

where are the Snafus?
The part that always seem to be left out from programming tutorials, or, if present, truncated to incomprehensibility (part of the ph.D curriculum I guess.. ;) is a bunch of common errors in writing the code.

Anyone who has done any programming have made mistakes that take forever to track down. Please add a section with the most obvious ones, and put it in the 'beginner' section. (a personal favourite is 'if ($X == $y;) {...}' which took a few re-readings to catch..)

How about some exercises per lesson?
Not just simple questions. I mean something along the lines of "Make a script that prints 'foo' if 'x' is true" or something like that. Doing this helps keep the concepts stuck in your head, and would be tragic if this textbook didn't have it.

First person writing?
Should addendums be added in first person, such as "I recommend ..."? How should this be handled? 209.149.56.162 00:35, 29 December 2005 (UTC)

Hey, i just noticed this too, I will correct the mistakes as the book is written by a lot of people,not one person ;p Wykis, 14:42 14 January 2006

There are many thing we can add on this section.

New presentation
I propose to change the look of the PHP book : we can use this look Programmation PHP (sorry in french). Do you like this ? Merrheim 10:07, 5 March 2006 (UTC)

wow, wish i knew about this b4. i think this page is going to change my life --Nerd42 16:58, 16 March 2006 (UTC)

I don't agree on this. I like the idea though. The design of that French page looks good but I prefer this book to be just like a normal book. Just a book :) Wykis 18:20, 29 March 2006 (UTC)


 * Wikibooks are viewed on a computer. Since there isn't a tangible book with pages to turn, an outline view would be really nice.  Getting between lessons in the current layout is rather tedious, and a TOC / Index / Outline view would probably work better than putting "Next Page" links on each lesson because the ordering of the lesson can change, and the navigation would break.  Changing the formatting would be a lot of work, but we should look into it (it doesn't have to be a carbon copy of the French layout).  It doesn't do anyone much good if the information herein is inaccessible.  --banzaimonkey


 * I'm working on some indexes at the moment, so don't go running off and do something I've already done. ;)  --Banzaimonkey 19:01, 11 July 2006 (UTC)


 * Make sure to let us know if your done or a estimate of when you're done would be nice as I believe this book is very incomplete and needs a lot added to it.AlReece45 02:39, 25 August 2006 (UTC)

For MediaWiki
it would be cool if there was a section on advice for would-be developers about writing bug fixes for MediaWiki. 128.250.37.103 07:41, 22 March 2006 (UTC)


 * Already exists? Did you try googlling about this? http://bugzilla.wikimedia.org/ helps quiet a lot. This is a Programming book for PHP, NOT for MediaWiki. Instead, try looking in IRC and . Wykis 18:18, 29 March 2006 (UTC)

Flag Frog = Ripped from Smarty?
Flag Frog templating system looks like a rip from Smarty template engine. Should this be removed from the page? Wykis 18:16, 29 March 2006 (UTC)
 * It looks like a fork of Smarty-Light. It's under the GPL, so I see no issue with it in and of itself, but I don't think it's something that needs to be posted on the PHP wikibook considering that as of now, there are 164 downloads in total of all version of the FlatFrog package.  Has anyone here heard of it before? Spoom 17:57, 5 April 2006 (UTC)

Major Changes to this Wikibook
I'm planning a significant overhaul for this wikibook. It currently has a decent amount of information but suffers from irregular organization, lack of verbocity, and has room for substantial additions of content. I've been writing a small todo list for myself, which you can view on my userpage. If you're an active reader / contributor and would like to take part in a discussion about changes to this wikibook, please reply in this page or contact me on my talk page. Otherwise I'll just assume that I'm the only person here who is active and will carry on with the changes as time permits. --Banzaimonkey 09:04, 12 July 2006 (UTC)


 * Update: I have been working on thing for a few weeks and am ready to proceed with a few things on my list.  Code examples will be wrapped in a color-coded box designating the type of code example (see Code Template for details).  I've also created a cover for the book which you can view here.  I've tagged the book as having a deprecated naming convention, and I will begin the process of migrating them to the new namespace once I decide what that namespace will be (probably PHP_Programming.  This will enable root auto-links on each page (returning the user to the main page), as well as conforming to the new naming convention (as of March 1rst, 2006).  Next on my list is an overhaul of the table of contents, but I'm still unsure how this will be reorganized.  If I have free time after all that, I'll go through this talk page and clean it up a bit.  --banzaimonkey 02:17, 6 August 2006 (UTC)


 * Update: The overhaul on the table of contents will probably take place before the migration.  This will allow me to figure out how things need to be organized when they're moved.  --banzaimonkey 06:39, 6 August 2006 (UTC)

Color Code Boxes
I have wrapped the first two Basic programming lessons. All code is contained in a colored template. You can view them here and here. Please leave your feedback in response to this post. My own thoughts are positive, but I'm not entirely satisfied with the functionality. I may rewrite the template with a more modular, extensible approach. --banzaimonkey 06:36, 6 August 2006 (UTC)

I think that it is a good idea. Makes for easier reading and quicker reference.Bounton 08:26, 12 September 2006 (UTC)

What do you think about adding syntax highlighting? In my opinion, it makes the code much easier to read. --King elessar 00:35, 20 September 2006 (UTC)
 * I like this idea if it's at all possible to do automatic syntax highlighting of PHP code within MediaWiki somehow. Also, have you taken a look at Template:Code:PHPHTML?  I don't know if you're already using it but it's a perfect fit.  Keep up the good work. --Spoom 18:03, 22 September 2006 (UTC)

Very interesting. I like it. Helps to highlight what we are trying to do with the code.

Its a good idea!

Love it. Reading is much easier on the eyes

good idea

Excellent idea. Much easier to read. Go on u's.

Book Cover
I've added the book cover to the main page to garner attention and feedback. Please leave your feedback here. When the book is reorganized and migrated, the book cover will appear on the main page and will link to the table of contents. --banzaimonkey 06:40, 6 August 2006 (UTC)

I personally like the design. It seems friendly, colourful and has PHP code and the elephant in it. It also seems like a cover you might see on a book. Good work.213.168.233.251

The licensing sounds incompatible (combination of GNU GPL and GFDL) - maybe elroubio would agree to license the elephant under the GFDL?


 * This licensing crap and legal encumbrance is the primary reason I haven't done any work on wikibooks lately. It's too tedious trying to figure out how to get everything done legally, much less organized, formatted, proofread, etc.  I don't do legal work unless I'm paid for it.  If someone else wants to contact him (he speaks French, btw), go ahead, otherwise... *shrugs*  --banzaimonkey 03:41, 25 October 2006 (UTC)


 * The GFDL is for documentation. Why do you want to use it for a image? —Andrew Hampe Talk 01:38, 24 July 2007 (UTC)


 * I had been under the impression that contributions to wikibooks were limited to GFDL (since the text is licensed as GFDL). It seems that is not the case, so I have changed the license to GPL to avoid any particular incompatibilities with the source images. --banzaimonkey (talk) 19:55, 10 December 2007 (UTC)

Ehh. I like it, brings good attention to the page

I like it. It makes more sense than Programming Python, the O'Reilly book. It has a mouse on it. SNAKES EAT MICE. (I'm curious, what does that code do?) --74.101.118.195 04:28, 23 July 2007 (UTC)

Reorg
I am going to reorganize the information contained in the "Hello World!", Nuts and Bolts, and commenting and Style modules to a more K&R approach:  "Hello World!" Variables Operators</li> <li>Expressions</li> </ul>

I think giving each topic its own module will make a better layout for reference use and break up complex topics so that they will be easier to learn. It will also be easier for us to maintain since it is clear where topics will go (trying to avoid duplicate data), so added bonus. Any issues? --Karl McClendon (talk) 12:23, 20 February 2008 (UTC)


 * As long as navigation is clear I have no problem... Fyorl (talk) 15:28, 21 February 2008 (UTC)


 * Yes, a good idea I think. The front page needs a bit of work.  &mdash; Sam Wilson ( Talk &bull; Contribs ) &hellip; 23:33, 27 July 2008 (UTC)

Experienced PHP developer
The Wikimedia Foundation office in San Francisco does have an opportunity for an experienced PHP developer. Dedalus (talk) 20:17, 11 April 2009 (UTC)

Orphaned page
PHP Programming/curl is not linked to from this book. Please merge it and mark it with, mark it with if no longer desired, or link to it from the proper page. -- Adrignola talk contribs 19:50, 4 August 2009 (UTC)

Research/peer review of PHP website architectures?
Just wondering if anyone here is interested in wikiversity:Topic talk:PHP &mdash; Sam Wilson ( Talk &bull; Contribs ) &hellip; 10:08, 30 March 2010 (UTC)

PHP is not fast
From the lead: Its popularity derives from its C-like syntax, its speed and its simplicity.

PHP is not exactly known for speed, see for example, PHP speed vs other languages.

Shouldn't this statement simply be left out?

--Mortense (talk) 11:47, 5 December 2010 (UTC)
 * Agreed. I've removed the statement from the lead. - <font color="#21421E" face="Harrington">EdoDodo talk 10:31, 12 December 2010 (UTC)

Style?
We need to define a way to write the code in examples here.

I propose:


 * 'else if', not 'elseif'
 * space after 'if', 'else if', and 'else'
 * four space indentation
 * <?php and ?> are on their own lines
 * Class names are LikeThis
 * function and variable names are likeThis
 * space after commas

Any thoughts or ideas?

Enter a username here (discuss • contribs) 23:40, 23 March 2014 (UTC)


 * I think it's a great idea to have a style guide for code examples here! There are already a dozen different coding standards out there; perhaps one of those could be adopted. For instance, PSR-0, PSR-1, and PSR-2 together form a pretty comprehensive guide. &mdash; Sam Wilson ( Talk &bull; Contribs ) &hellip; 11:47, 24 March 2014 (UTC)