Introduction
For some AJAX is marketing speak for something that has been around for years. For others, it is the salvation they have been looking for, for seemingly centuries. I would tell the former group that the latter group finally caught up, and you should revel in the growth of your new community and accept them with open arms. Snobbery really won’t help anyone.
Recently Jesse James Garrett from Adaptive Path wrote an article for the duo at Ok-Cancel called “Why AJAX Matters Now”. As usual Jesse is insightful and dead on about why AJAX has arrived. More aptly I would say that Jesse describes well why the world is now ready for
AJAX where earlier uses of the same technology had really no chance of taking off.
Jesse does still speak of AJAX’s arrival in his article, and while it is not such an important distinction, I would like to correct him and say that AJAX (as our former group notes above) has been around for a while, and that other environmental variables have been put in place to make AJAX consumable.
Continue Reading The Tutorial
Showing posts with label Begineers. Show all posts
Showing posts with label Begineers. Show all posts
Classes and Functions in PHP: Simple Tutorial for everyone
Classes and Functions in PHP: Simple Tutorial for everyone
A class is a function of PHP that has its roots in object oriented programming. The ability to use classes in PHP has been increasing with later versions. If you want to add the power of classes to your PHP programming, keep reading.
Introduction
Continuing our PHP functions article, we move on to creating classes. Let me say right at the start that you can write perfectly effective and useful PHP code without creating classes or going into object oriented programming. Another thing is that PHP, at its core, is not an object oriented language. This is because PHP was built from the C language, which is at its core a procedural language, rather than a methodical one. However, object oriented programming can be very powerful and PHP programmers are increasingly taking advantage of these capabilities, which have been greatly expanded since PHP4.
What is a class?
A class is a collection of variables and functions that serves a common purpose. It gives you the ability to think about real world objects and translate them into code. For example, let's try to describe a car. The class "car" might have variables: $name_of_car, $wheels, $steeringwheel, $windscreen, $lights, $pedals and $brakes. The functions of a car might include Turnleft(),Turnright() and Accelerate(). The function "Accelerate()" might take arguments such as $increase_speed. Now, all of the above describes a car and what a car does in both real terms and in code.
Now you might ask, couldn't this be done with regular functions and variables? Yes, it could, especially if you were talking about one car. But if you are talking about more than one car, then it would be impossible to keep up with all the various variables and functions associated with multiple cars. This is where classes become very useful, because classes bring all those variables and functions under one name. In this case, it's an object named "car." Now if you have more than one car, all you have to do is instantiate that object. The term instantiate basically means making a copy of the object. The new copy will have all the variables and functions of the original object available to it. You can include the class in any script that you create; the class will work the same.
Let me sound a cautionary note. Although OOP makes coding easier and more portable, the objects' execution time is less efficient than writing straight code. And while OOP speeds up project development drastically, more often than not, it produces less customized and slower applications. So, be aware of these pitfalls when choosing to use OOP.
OOP is arguably difficult to learn, so in this article I am going to use very simple examples to demonstrate how to use OOP. This should help new users grasp the concepts easily. Also, because OOP is such a huge topic I will only deal with the basics so as to give you the ability to easily learn the more advanced aspects of it.
For more read on here
http://www.devshed.com/c/a/PHP/Classes-as-PHP-Functions/
Cheerz
Web Coder
A class is a function of PHP that has its roots in object oriented programming. The ability to use classes in PHP has been increasing with later versions. If you want to add the power of classes to your PHP programming, keep reading.
Introduction
Continuing our PHP functions article, we move on to creating classes. Let me say right at the start that you can write perfectly effective and useful PHP code without creating classes or going into object oriented programming. Another thing is that PHP, at its core, is not an object oriented language. This is because PHP was built from the C language, which is at its core a procedural language, rather than a methodical one. However, object oriented programming can be very powerful and PHP programmers are increasingly taking advantage of these capabilities, which have been greatly expanded since PHP4.
What is a class?
A class is a collection of variables and functions that serves a common purpose. It gives you the ability to think about real world objects and translate them into code. For example, let's try to describe a car. The class "car" might have variables: $name_of_car, $wheels, $steeringwheel, $windscreen, $lights, $pedals and $brakes. The functions of a car might include Turnleft(),Turnright() and Accelerate(). The function "Accelerate()" might take arguments such as $increase_speed. Now, all of the above describes a car and what a car does in both real terms and in code.
Now you might ask, couldn't this be done with regular functions and variables? Yes, it could, especially if you were talking about one car. But if you are talking about more than one car, then it would be impossible to keep up with all the various variables and functions associated with multiple cars. This is where classes become very useful, because classes bring all those variables and functions under one name. In this case, it's an object named "car." Now if you have more than one car, all you have to do is instantiate that object. The term instantiate basically means making a copy of the object. The new copy will have all the variables and functions of the original object available to it. You can include the class in any script that you create; the class will work the same.
Let me sound a cautionary note. Although OOP makes coding easier and more portable, the objects' execution time is less efficient than writing straight code. And while OOP speeds up project development drastically, more often than not, it produces less customized and slower applications. So, be aware of these pitfalls when choosing to use OOP.
OOP is arguably difficult to learn, so in this article I am going to use very simple examples to demonstrate how to use OOP. This should help new users grasp the concepts easily. Also, because OOP is such a huge topic I will only deal with the basics so as to give you the ability to easily learn the more advanced aspects of it.
For more read on here
http://www.devshed.com/c/a/PHP/Classes-as-PHP-Functions/
Cheerz
Web Coder
Subscribe to:
Posts (Atom)