What are some examples of the limitations of PHP with JavaScript? - php

I'm looking for problems I can generalize, recognize later (in design), and say
"Hey, if I continue down this road I'm going to hit trouble. PHP + JS just weren't meant for this."
If I'm using PHP+JS what can't I do? What shouldn't I attempt? What do you suggest instead?

It is software, almost anything you can imagine is possible, given enough time and resources. I don't see how PHP would preclude you from doing anything in JavaScript, or anything in JavaScript could preclude you doing something in PHP. They are separate technologies which run at each end of the client/server architecture which can be built to work cooperatively.

It's easy to get in trouble with PHP and JS by themselves without using some type of framework. PHP can degrade into a mess of spaghetti code quickly if you do not follow some type of convention like the Zend Framework or others.
That said, I don't think you'll find anything that PHP CANNOT do ...

I'd take a look at this and see what the limitations of JS are. The reason this is important to know is that xml performance on JS is just bad, use JSON. The other thing to note is that if you really need to show that many rows of data on a page, it would be better to use flash/flex solution. [warning, that link doesn't work for Firefox 3, it just dies]
I will note though that most of my experience has pointed me to the fact that there normally isn't a reason to show that many things on a page. If I come across a usecase, I usually can just AJAX something in on the fly to keep from having to load so many things at once.

The only problem you will encounter is at least 10 years away when Javascript or some kind of open source scripting framework becomes the Web standard. Server side scripting languages like PHP, ASP, JSP, etc and Plugins like Flash, SVG, VRML fill in gaps that a relatively slow client side scripting language like Javascript cannot accomadate. In the future, as PCs get faster and Javascript engines continue to get more efficient, you will see the gradual decline of 3rd party solutions like Server side scripting and plugins. Then the only problem you will face is a bunch of old code that gets laughed at by the cyber punks zooming by on their anti gravity boards. Ofcourse, this is in the future, and by the looks of things the specs people loving dragging their feet.
So in short, PHP is your only hope for doing anything useful in a browser for the forseeable future. Your only worry should be whether you want to learn ASP instead, its pretty cool. Although PHP has a huge community and code snippets galore.

Related

Alternatives to php for in-line web programming?

I first learned web programming with php a while back. It has some features that I find very helpful, but the overall language is not something I enjoy, just as a matter of personal preference. I am wondering what alternatives I could use to provide similar functionality using a different underlying programming language (Python? Ruby?).
What I am looking for:
general purpose programming capability
in-line server-side code embedded in HTML (i.e. I want to be able to make my documents pure HTML if desired, rather than demanding special syntax even where I don't want dynamic content)
access to request parameters
ability to send headers, set cookies, etc
Preferably:
does not require a separate server process
easy to connect with Apache
Does anyone have any suggestions?
One thing I tried to do was embedded Ruby (erb) through CGI. This looked like a good fit on paper. Unfortunately, I was not able to get it to work, because I was following a few different guides and the result of combining them did not work out. At any rate, it seems this would not allow me to set arbitrary headers (and more importantly, use sessions and cookies).
Note: I'm not looking for a full web framework at the moment. Just relatively small amounts of dynamic content among otherwise HTML pages.
Thanks!
You've hit on the big reason why PHP is so popular - it has all of those pieces in a server-embeddable package. There aren't really many solutions with its ease of deployment; PHP is written specifically for what you want, which is both its strength and weakness. It's why it's such a weak general-purpose language, and why everyone and their dog knows it. It's everywhere, and the barrier to entry is near zero.
PHP is a language plus templating plus a web framework all baked into one package. To get an equivalent, you're going to need a web framework, even if it's a small one. Something like Sinatra is a super lightweight way to do similar in Ruby, though it requires a separate server process.
You could look at something like Perl with cgi.pm, but it may be a step in the wrong direction if you're wanting something cleaner than PHP.
I don't know Python packages well enough to offer suggestions there, but Twisted makes it easy to bind a Python program to a web interface. That does end up running in its own server process, though.
You'll need to do a little more work than your standard PHP deploy if you want to use something besides PHP, but that's often a choice that people consider to be a reasonable tradeoff for gains in productivity.
Python Flask is a good web framework: it fits your requirements, easy to learn, and scales gracefully. Go through the tutorial to see!
I have three suggestions.
The first is Ruby on Rails - It's pretty fun once you get into it.. I would recommend going through Rails for Zombies to get a general idea of whether you like it or not.
http://railsforzombies.org/
It's really easy to get something up and running on Heroku for free, so you don't have to spend any money to get something up on the web..
My second suggestion is one I'm just trying out called Node.js. I'd recommend watching this video to get an idea of what it's about:
http://www.youtube.com/watch?v=jo_B4LTHi3I
If you're into Javascript, I think you'll get it right away. You can also build an open source Node.js project on www.cloud9ide.com which is pretty nifty too.
A third one, if you're into learning Java, is "Play". A cool video on this is:
http://vimeo.com/7087610
I haven't used this much, but it's on my "to do" list of things to check out. Overall, I suggest just dipping your toes in the water for a bunch of different frameworks and get an idea of how they work and then you'll naturally pursue whatever makes the most sense to you. Good luck!
I'd say given your requirement
Just relatively small amounts of dynamic content among otherwise HTML pages.
then, PHP is going to be hard to beat for getting going quickly and a minimum of learning overhead. It avoids all the CGI issues that you would otherwise have to deal with, and is in fact its own templating language. That's why so many get started with it. Once you get past the point of your goal of mixing a little programming logic into HTML pages, and developing more flexible, maintainable and testable applications, then frameworks such as Rails, Django and others will be worth your time to learn.
Using Scheme as a web development language meets your criteria, with a caveat: instead of inline code embedded in HTML, you have inline code embedded in the Lisp-ish representation of HTML called s-expressions. (There is a one-to-one correspondence between HTML and is s-exp equivalent; they can be interconverted with one function call.) So the static parts of your page and the code share the same syntax - something I really like about Scheme.
> (sxml->xml `(div (p "It's been: " (i ,(current-time)) " seconds")))
<div>
<p>
It's been: <i>1339772791</i> seconds
</p>
</div>

NOT PHP vs JS Comparison: Can I do anything in PHP that can be done with JS?

I've now got some very good understanding of (X)HTML and CSS, and plan to move on. My next choices are PHP and JS (and don't know if I'll ever end up learning one of them, but I would love to).
So, I need to choose one of them. I have learnt that PHP is server-side programming and JavaScript is client-side programming, and I am NOT asking you to compare the two of them for me. What I would like to know is, can I do anything (or most of) in PHP that can be done with JS? (or put it this way, can do everything people use JS for, on the server-side with PHP?)
Instances include, using PHP instead of JS in web themes, real-time content display (as in live blogging, live comments etc), effects etc.
This might seem dumb, and there's definitely a reason why people use JS in all the above instances, but since I cannot (really) learn the two of them, thought I should ask for some advise here.
EDIT: Would it be possible to reload only a part of a web page (not the entire web page) every few seconds with PHP? That should be good enough for the real-time application that I am planning.
If you absolutely don't want to learn both, then learn Javascript. There are possibilities to implement a Javascript-based backend with node.js.
I advise you to at least try PHP since it is widely used - maybe even at your company.
For nice user experience (dynamic menu, ajax, effects, ... ) you need client-side programming and for dynamic content you (almost always) need server-side programming.
In short, you need both.
PHP and JavaScript cannot really be compared in the way you're asking...
Both are powerful in what they've ment for and they have a very similar syntax. If you can't absolutely study more than one of them, learn PHP in my opinion. I coded with PHP for almost 10 years before really getting into JS. I would say PHP is the food and JS is the spice.
In order to create AJAX web apps Javascript AND a server-side language is required.
No, you can't. PHP only works on the server side. Once you've delivered content to the client, PHP can't do anything until the page reloads or the user loads a new page. If you want to do anything client-side in between, you need JavaScript (this includes loading content in real-time, doing a lot of modern UI stuff, etc).
Either learn both PHP and JS or use a blogging CMS and use a minimal amount of both.
If you put enough effort into it, you can do almost anything server-side using lots and lots of page reloads. You can also generate arbitrarily complex dynamic content using Javascript.
But it's a lot easier to do minor changes to a page's content from Javascript, it's only possible to do animations and effects from Javascript. It's also much easier to directly access the database from server-side code – there might be pure-javascript drivers for SQL databases, and you could use a NoSQL databases that's accessed using web services, but both are relatively uncommon techniques.
I have a thought regarding your original question/situation. I know this is about four years tardy, but I thought I should throw in my two cents for people who are looking back on this conversation as a reference from Google like I am. In your situation, because you are a blogger who is trying to save time when it comes to programming, I would recommend looking into WordPress (the .org version, not the .com). It is a sort of marriage of WYSIWYG blogging/website creation and programming. It takes care a lot of the back end stuff (including Javascript, PHP, and more), but also leaves it open for you to edit if you so desire. You probably could get away with using Wordpress as a total non-coder, but with HTML and CSS, you're already off to a great start. WordPress is super simple to learn and amazingly powerful. If you do take this route, I would suggest learning PHP as an asset because that is the language that WordPress runs off of. If you know PHP and are using WordPress, you have vast potential, not to mention that speedy blogging is a snap. If you don't feel the need to have whipped everything up from scratch and want to work faster, give WP & PHP a try. They'll take you a long ways.

Advice for a novice PHP enthusiast

I am totally new to PHP, I want to know whats the difference between PHP,CakePHP and Joomla.
Which IDE is most commonly used for developing PHP based web applications.
How Ajax is implemented in PHP, is it through JQuery only or there's something more to it.
Which will be the ideal book that covers most of the basic and advance concepts.
PHP is a programming language.
CakePHP is a framework written in PHP.
Frameworks establish a basis for quickly developing applications by providing you with a lot of functionality that you would have to write in plain PHP for most applications anyway. For example, secure database access, session management or pagination. These are all tedious things you have to care about, but that are basically the same for every app. It also establishes a certain structure for your project.
Joomla is a CMS, a content management system, written in PHP.
CMSes are pre-built systems you can use as-is, that allow you to manage your content. They're extensible and customizable, but often not to the degree that an app written in plain PHP or using a framework can afford, or not easily so. There's a lot of functionality in there already though that you don't need to write at all.
AJAX is not implemented in PHP at all.
AJAX just means that Javascript asks your server for data and the server delivers it.
A typical PHP page responds to requests with a complete HTML webpage. For AJAX requests your server instead responds with XML, JSON or plain text, whatever you decide. It works exactly the same way as responding with an HTML page.
Javascript is a programming language.
jQuery is a library written in Javascript.
See framework, the definition is almost the same.
For IDE recommendations, do a search.
PHP is a programming language
CakePHP is a framework
joomla is a CMS
AJAX - php is executed server-side and as such isn't something "implementing" ajax. The original call comes from client-side javascript that is not limited to JQuery. JQuery is a javascript library.
Ajax isn't implemented in PHP. Ajax is client-side technology. PHP is server-side. I started using Eclipse's PHP IDE, but I found the debugger to be more of a hassle than it was worth. I'm still using the IDE, but I'd probably be just as well off with a plain text editor.
You might want to check out Zend (www.zend.com). Most of their tools are commercial based, but they have some free tools that help you run PHP on your own machine.
I don't personally use a PHP framework, so someone else will have to help you with that one.
When I was first introduced to PHP, I was directed to these free instructional videos.
While they don't directly address your question, I'd be wrong to not perpetuate the kindness by sharing them with a new, novice enthusiast.
Good luck!
You are asking a lot of questions at once, which are fairly simple questions but the real answer is you need to learn a bit more about web development in general in order to give yourself a broad knowledge of the web development ecosystem. Stack Overflow is not good at giving you 'how do I program in PHP', it's better for specific questions like 'how do I sort an array by string size' or something like that. For learning how to program, you need to learn this yourself.
The wikipedia page on web development gives a very broad overview of how things like server-side, client-side etc fit together - so broad as to not be particularly useful for those wanting to achieve anything in particular, but suitable for people coming across web development from not knowing the difference between an application and a programming language. An equally broad knowledge of http is also helpful, and since you brought it up, it also looks like you are having difficulty understanding what ajax is.
For PHP specifically, the PHP manual contains everything you need for all but the most obscure questions, providing you have picked up a few programming skills already - and if not, I recommend you take a course or something, since if you haven't been programming since you were a child you probably won't take to this kind of thing quickly.
A little-known but powerful solution for AJAX in PHP is Xajax. It allows you to call PHP functions asynchronously as AJAX calls, making it by far the most familiar solution for people familiar with PHP but not Javascript.
Beware, however, that a huge portion of the users are based in Europe so the help forum can be VERY difficult to understand and official documentation is similarly spotty.
I personally always advise against using a book to learn--stick to quality websites (which ones become very obvious very quickly) By the time something is put into print, it's usually out of date or has been superseded by better technique. While the basics don't change much, there are many day-to-day things that experienced developers use regularly that you won't find in a book. I also advise learning the basics of development first (object oriented theory, logic progression, arrays, etc) before learning the specifics of any language. PHP.net can define specifics all day, but it's far more difficult and time consuming to learn MVC theory on the fly. Finally, if you have some money, I can't say enough good about Zend's certification training.

Is there an application that can convert PHP code to ASP.Net?

I'm tired. I have ~30 really messy PHP files in my project. Hearing people say that Asp.net is more structured , that it is better (I'm mostly relying on Jeff's advice #codinghorror here) and that it is possible to use asp.net without using bloated software from M$. I don't want to and will not convert the the work done upto now, by hand.
Note: I want a good tool -- I don't want to go from ~30 unstructured and messy files to even messier stuff stored in a quantillion directories with odd file names (Java)
The difficulty is that you can do some things automatically in ASP.NET that you have to do by hand in PHP. For example, if I change a input textbox and when I tab away I want it to be saved automatically, in ASP.NET I can use AutoPostback='true'. Then, in the code-behind you would handle this update.
My point is that ASP.NET and PHP are very different, in that there are so many tools that ASP.NET that you can use, so your code will look very different when going from PHP to ASP.NET.
I think using a tool would be a bad idea, as this rewrite would give you a chance to clean up the code and to decide which options to use that are available.
UPDATE: In order to do more with interactive applications there is a free toolkit available that I would recommend:
http://www.asp.net/ajax/AjaxControlToolkit/Samples/
I build automated translation tools for a living (see DMS Software Reengineering Toolkit. In my 15 years of experience doing juist this, it isn't worth the trouble to build ("customize DMS" or do something similar with a similar techology if you can find it) a translator for 30 * 1000 lines of code.
You might be hoping for somebody to have done this in advance, "Gee, wouldn't it be keen if somebody built such a translator and I can just use it?" Such a hope is pretty forlorn. The problem is that every source application uses some arbitrary combination of input technologies (you're probably using PHP, MySQL, JavaScript and some weird libraries) and want some arbitrary configuration of output technologies (ASP, TSQL, JavaScript, C# libraries). The space of input/output configurations is too vast for you to have any real chance of encountering at translator that somebody might have built that matches your needs. Therefore you'll need a custom translator. Ooops, back to the previous paragraph.
You can pray for miracle. But I suggest you clean up your PHP files and live with them. The world is full of "beware what you build, because it will last a lot longer than you expect". Choose your technology and architecture more carefully next time, so you don't end up with "messy files".
I'm not sure how much luck you'll have finding a program that'll convert 30 messy PHP files into beautifully structured ASP files, I think someone would make quite a fortune with something like that (and a lot of us would be out of jobs). However, if you really want to pursue it, googling for "convert php to asp.net" turned up multiple results.

What should every PHP programmer know? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Closed 8 years ago.
Locked. This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions.
I would like to be a PHP/MySQL programmer
What are the technologies that I must know?
Like:
Frameworks
IDEs
Template Engines
Ajax and CSS Frameworks
Please tell me the minimum requirements that I must know, and tell me your favourite things in the previous list?
Thanks
First off, there is no must know about learning PHP and MySQL... You go into it not knowing anything, and you'll come out of it knowing a bunch. If there was a must know, then nobody would be able to get into PHP and MySQL development. I personally think you are at a slight advantage going into this without knowing everything about it. It'll give you a fresh perspective and a think outside of the box attitude :)
As far as the object oriented stuff in this thread, it's true. But, as others have said, it's completely up to the programmer (you) to decide how to write your code. You can use object oriented practices, make a spaghetti code junction, or just right a bunch of functions, or whatever. Either way, as everyone else has been saying, it's up to you :)
IRC channel:
Don't really need this, but I find it helpful... See you in here :)
irc.freenode.net #php
Manual:
The manual is your friend and probably the only thing you should know before diving in.
http://www.php.net/manual/en/
http://dev.mysql.com/doc/refman/5.0/en/apis-php.html
Frameworks:
Make sure it's an MVC framework :)
http://www.cakephp.org/
http://www.phpmvc.net/
http://www.codeigniter.com/
http://www.symfony.com/
http://www.laravel.com
http://www.yiiframework.com/
IDE:
Whatever suits you best :)
http://www.eclipse.org/
http://www.vim.org/
http://www.zend.com/en/products/studio/
http://php.netbeans.org/
https://www.jetbrains.com/phpstorm/
Template engines:
PHP is a good template engine
Model view controller frameworks help with this
twig.sensiolabs.org
http://www.smarty.net/
Ajax:
http://jquery.com/
http://www.mootools.net/
http://developer.yahoo.com/yui/
http://www.prototypejs.org/
http://www.extjs.com/
http://code.google.com/webtoolkit/
https://angularjs.org/
CSS:
http://www.yaml.de/en/home.html
http://code.google.com/p/blueprintcss/
http://developer.yahoo.com/yui/reset/
Definitely not an exhaustive list, and things change constantly... But, it's a start :)
Have fun!
Chrelad
Security is an important topic every web programmer should study before being allowed to post code that can be accessed publicly on the internet.
Examples of security issues:
Injection flaws
Cross-site scripting flaws
Cross-site request forgery
There are more security issues that you should know and keep in mind as you write PHP applications. The website http://www.owasp.org contains lots of useful information to help.
PHP was my first language, which I learned on the side while working as an office junior in my first job over 10 years ago. Here is some things from my experience:
Download the PHP manual, print it off, and start reading from page one. Keep going till you're at the end. Skim over the bits you probably won't need (like using KADM5 or Hyperwave) but always read the introductions so you know what PHP is capable of (this will save you trying to re-invent the wheel). The PHP documentation blows the docs of pretty-much every other language I've worked with since out of the water.
Next step; set up PHP. Manually. Don't use XAMPP or anything else, do it yourself. It always helps to know how your environment is set up.
Don't bother with an IDE at the beginning. Getting to know a language means getting up-close-and-personal. IDEs obscure things in an attempt to help you GetThingsDone which works great when you know what you're doing and know your target environment, but when you're starting out they just get in the way and hide what's important.
Don't bother with frameworks at the beginning, either. Again, they're there to help you GetThingsDone which only works when you know what you're doing in the first place. Start with the basics, otherwise you'll be learning the framework and not PHP.
PHP is essentially an advanced templating engine. Don't fall into the trap of over-hyped "PHP templating engines". They're just doing what PHP already does, doubling-up on the work and running twice as slow as PHP does. Stick with inline html/php to start with. Again, this'll help you get to understand what PHP is, how it works, and when to use it.
As with AJAX and CSS... they're nothing to do with PHP, but with the output you produce from PHP (and with AJAX getting input in). Don't load your plate with too much to eat at once. Start with plain PHP+HTML, and do your CSS by hand. Then, when you're happy, mix in a little javascript.
The best thing you can do with any language is learn the environment you're going to be working in, because programming is (relatively) similar across all of them. They all have loops, data structures, input/output, etc, but they all work just that little differently.
Don't believe the hype. I'm moving from PHP to Python at the moment and I could've just jumped on the Django band-wagon to GetThingsDone, but I know that if I came across a problem I wouldn't know where to begin to fix it. So I'm taking my own advice and starting from the beginning; reading the manual, setting up an test system, parsing simple files, getting input/output, getting it linked in with a web server... all part of getting to know my new environment.
What should every PHP programmer know ?
You need to know a language that is not PHP. I'm not saying you shouldn't develop your sites in PHP, it's actually really good for that, but you really need to know at least one other language to get some perspective.
Why? PHP is broken and full of bad design and misfeatures. You can write excellent code in PHP, but you're never going to be able to spot the bad design and failures of PHP itself if you don't know any better.
I'd suggest python, ruby, or C#
PS: If you don't think this is a helpful suggestion, then by all means downmod this answer, but if you are downmodding because you feel insulted by my claim that PHP is broken and badly designed, don't shoot the messenger, I'm just telling the truth!
First of all, that PHP itself IS a templating system
Security.
Just like Lucas Oman said - it is up to you in PHP to write the code well; and it does not coddle you. If you don't understand why you need to confirm a logout, or why you can't just validate in javascript, or why register_globals is bad - your app will be vulnerable in some form or another.
You need to learn the following (I would suggest in this order):
Basic Object-Oriented Principles (such as inheritance, polymorphism, and encapsulation)
The PHP language itself. Specifically, PHP 5.
Database Design Principles such as tables, keys, relationships, normalization, etc.
SQL - Structured (or Standard never can remember which) Query Language. Specifically learn the basics of select, insert, update, and delete queries.
Good design principles and coding practices (you can find posts here on StackOverflow for one) such as dividing presentation and business logic.
A Framework, Any Framework - this will help you become introduced to more advanced concepts of object-oriented design patterns and allow you to follow tutorials that will encourage good design and coding practices.
Object-Oriented Design Patterns like MVC, Database Abstraction Models and the like
Advanced SQL and other database stuff like triggers, stored procedures, and other functions.
Ignore the mysql_* functions. Not only do they provide no straightforward method of writing secure code, they actually go out of their way to make it painful and tedious if you try. Use mysqli or PDO instead (and you've got no excuse now - PHP 4 was end-of-life'd months ago).
All good answers, but there is something important missing: If you want to seriously get into PHP, then you should be aware that there are a lot of PHP programmers out there who are lazy, inept, ignorant, misguided and unfortunately get their code released to the public. The history of PHP means that it supports some questionable features (not just things like register_globals but also smaller things like automatic initialization) and people still use them. You don't want to.
I would say the most important thing is to learn how the whole process of building a page with PHP works - in that requests come from a client (web browser), hit the web server, get passed through to PHP, which then generates the response that is sent back. A solid understanding of this will ground you in
why you can't send headers after output has started
how sessions and cookies work
how each page should be built in a stateless manner (i.e. deliver whatever the request asks for, don't remember what happened last time, or guess what the user is doing)
The difference between HTML, PHP, JavaScript and CSS, and more importantly, what each is used for primarily and where the responsibility of each lies.
Once you've got that down, then you should be quite comfortable with writing any app. But unless you've got that down, you'll start mixing things as I've seen many rookies do before now.
That every value everywhere has to be encoded appropriately. echo $some_variable_that_seems_innocent is evil nine times out of ten.
Use htmlspecialchars() in HTML/XML, prepared statements or at least addslashes() when building SQL queries, json_encode() when inserting values into scripts, rawurlencode() when appending URL components, escapeshellargs() when constructing shell commands, etc.
If you insert text in URL that's part of a script in XHTML document, you'll need to encode data three times.
Although this isn't a technology, I think it's very important that you understand that, when using PHP, it is completely on you to write good code. PHP is capable of it, but it does not encourage it. You are completely responsible for writing code that is well designed and, if you choose, follows OO principles. You will have no help from the language.
Use a great IDE (like Eclipse for example) that let you debug and have some code completion. This will save you some time.
PHP have a lot of programmer and is very popular = a lot of thing is already done for you, before writing some code, doing a google search is always a good idea.
You should use some of the Framework if you start from scratch. This will answer all your question about AJax, template engines... because most of them come with these packages.
Here is some post about how to start choosing a framework: SO 1, SO2, Here is a list of PHP Framework.
You can develop PHP on Windows, Linux or Mac.
Getting a web server setup
To run PHP and MySQL locally on your computer you will need to install Apache webserver with php module and MySQL database server. ie. a LAMP webserver (Linux Apache MySQL PHP).
In the past, I would recommend installing Ubuntu. These days, there are a few solutions available that will give you one click installation webserver without using linux.
For Windows:
http://www.wampserver.com
For OSX:
http://www.mamp.info
After having a LAMP webserver use w3schools.com tutorials to start.
I would say a basic one would be HTML. ;)
No Php framework expert.As templating which make the system much complex then as it.
Understand business logic requirement and think the cons/pro.Hoping for SA to think all for you is not good programmer.
No ajax.I dealing with large of data,rendering to one js file about 4000 k data is very bad.
Start from notepad or VI
After learn php about 1 to 2 years,try learn other language like c# or c++ to improve your php application.
Php is addicted language rather then other language.You type it works.Other language,you type It's Compile It's Hang up.
7.For complexity application,php is the best to me rather then other language,because you think,you write it works.
You should know how to use effectively at least one Debugger/IDE. It is amazing what you can learn from your code by stepping through it and watching it run. It both makes it much simpler to track down bugs, and improves the quality of your code. I believe you should never commit code to a project that you haven't seen execute.
The PHP Language
Go to PHP.net and read through all of the documentation. When you are done, you won't know everything you need to know about php, but you will know where to look.
Be careful of code snippets you find on the web. Often they contain sql in html, which is bad practice, as well as security vulnerabilities such as sql injection. I've seen few that use prepared statements, which is good for security.
Personally, I found the book "Build your own database driven website using PHP and MySQL" extremely helpful.
Other than that, the one thing I found hardest to get used to with PHP is how relaxed it is, compared with any other language I've ever used. By that I mean no types, flexibility about syntax and punctuation. Personally I think that's a good thing, but I also know that it probably encourages pretty bad behavior.
Here's one other tip I have: try to use something like the DRY principle -- i.e., you'll find yourself writing the same little (or big) bits of code over and over again -- make them into functions as early as you can in the process of coding, and life will be a lot easier later on.

Categories