im learning CODE IGNITER Framework.
its suppose to make it easier to create web site.
ive been using it for 2 month and its really simple.
its has online tutor and some video about making simple web.
for pro and beginner in php you can use this after you know how to create class and stuff or just i say Object Oriented Programming in PHP
.
thats it
Friday, November 7, 2008
Wednesday, February 27, 2008
PHP 5 other OOP Code
other oo code
class Cat {
function miau() {
print "miau";
}
};
class Dog {
function wuff() {
print "wuff";
}
};
function printTheRightSound($obj) {
if ($obj instanceof Cat) {
$obj->miau();
} else if ($obj instanceof Dog) {
$obj->wuff();
} else {
print "Error: Passed wrong kind object";
}
print "\n";
}
printTheRightSound(new Cat());
printTheRightSound(new Dog());
//end class
the output is
miau
wuff
Inheritance is performed by using the [extends]
keyword :
class Child extends Parent {
//....
}
This how you would rewrite the previous example
using inheritance :
class Animal {
function makeSound() {
print "Error : This Method should be re-
implemented ins the children";
}
}
class Cat extends Animal {
function makeSound() {
print "miau";
}
}
class Dog extends Animal {
function makeSound() {
print "wuff";
}
}
function printTheRightSound($obj) {
if ($obj instanceof Animal) {
$obj->makeSound();
} else {
print "Error : Passed wrong kind of object";
}
print "\n";
}
printTheRightSound(new Cat());
printTheRightSound(new Dog());
\\end class
THe output is
miau
wuff
and this is the summary that i read its really
cute
"if youre new to PHP but have written code in
object oriented language,
youll probably not understand how people managed
to write object oriented code until now.
if youve writeen object oriented code in PHP4,
you were probably just dying for these new
features"
so what if im really new to object oriented
language.
itll probably i can never understand what should
i do with it.
i read and read and im done with this im off.
i peek in chapter 4 and its an advanced
OOP.....okay !-_-.
i think i need codes that written using OOP
techinque and lots of them so i can get the hang
of it.
in chapter 5 itll be Web Application.
class Cat {
function miau() {
print "miau";
}
};
class Dog {
function wuff() {
print "wuff";
}
};
function printTheRightSound($obj) {
if ($obj instanceof Cat) {
$obj->miau();
} else if ($obj instanceof Dog) {
$obj->wuff();
} else {
print "Error: Passed wrong kind object";
}
print "\n";
}
printTheRightSound(new Cat());
printTheRightSound(new Dog());
//end class
the output is
miau
wuff
Inheritance is performed by using the [extends]
keyword :
class Child extends Parent {
//....
}
This how you would rewrite the previous example
using inheritance :
class Animal {
function makeSound() {
print "Error : This Method should be re-
implemented ins the children";
}
}
class Cat extends Animal {
function makeSound() {
print "miau";
}
}
class Dog extends Animal {
function makeSound() {
print "wuff";
}
}
function printTheRightSound($obj) {
if ($obj instanceof Animal) {
$obj->makeSound();
} else {
print "Error : Passed wrong kind of object";
}
print "\n";
}
printTheRightSound(new Cat());
printTheRightSound(new Dog());
\\end class
THe output is
miau
wuff
and this is the summary that i read its really
cute
"if youre new to PHP but have written code in
object oriented language,
youll probably not understand how people managed
to write object oriented code until now.
if youve writeen object oriented code in PHP4,
you were probably just dying for these new
features"
so what if im really new to object oriented
language.
itll probably i can never understand what should
i do with it.
i read and read and im done with this im off.
i peek in chapter 4 and its an advanced
OOP.....okay !-_-.
i think i need codes that written using OOP
techinque and lots of them so i can get the hang
of it.
in chapter 5 itll be Web Application.
PHP 5 Touching OOP
i read and i read and im confuse. ok next chapter.
PHP5 OO Language
wow now im actually learn Object Oriented thingy.
class Person
Method :
setName($name)
getName()
Properties :
$name
and this is the code :
class Person {
private $name;
function setName($name) {
$this->name = $name;
}
function getName() {
}
};
$judy = new Person();
$judy->setName("Judy");
$joe = new Person();
$joe->setName("Joe");
print $judy->getName() . "\n" ;
print $joe->getName() . "\n" ;
itll print the name.
PHP5 OO Language
wow now im actually learn Object Oriented thingy.
class Person
Method :
setName($name)
getName()
Properties :
$name
and this is the code :
class Person {
private $name;
function setName($name) {
$this->name = $name;
}
function getName() {
}
};
$judy = new Person();
$judy->setName("Judy");
$joe = new Person();
$joe->setName("Joe");
print $judy->getName() . "\n" ;
print $joe->getName() . "\n" ;
itll print the name.
PHP 5 First Touch
Right now the book called PHP5 Power Programming is helping me.
Itll let me learn few basic code which i prefer it that way and i hope i can create MySQL & PHP Application and other app that use PHP5.
im not reading any of chapter 1 but just go straight to chapter 2 that consist Basic Language.
this code is HELLO WORLD with HTML Embedding.
<html>
<head>Sample PHP Script</head>
<body>
The following prints "Hello, World"
<?php
print "Hello World" ;
?>
</body>
</html>
this will lead to this output
<html>
<head>Sample PHP Script</head>
<body>
The following prints "Hello, World"
"Hello World"
</body>
</html>
Comment
/*
* this is C way
*/
// this still is c way
# this is shell way
VARIABLES
its very different from C and Java you dont need to declare their variable before using them, you dont declare their type as result variable can change their type of its value as much as you want.
Itll let me learn few basic code which i prefer it that way and i hope i can create MySQL & PHP Application and other app that use PHP5.
im not reading any of chapter 1 but just go straight to chapter 2 that consist Basic Language.
this code is HELLO WORLD with HTML Embedding.
<html>
<head>Sample PHP Script</head>
<body>
The following prints "Hello, World"
<?php
print "Hello World" ;
?>
</body>
</html>
this will lead to this output
<html>
<head>Sample PHP Script</head>
<body>
The following prints "Hello, World"
"Hello World"
</body>
</html>
Comment
/*
* this is C way
*/
// this still is c way
# this is shell way
VARIABLES
its very different from C and Java you dont need to declare their variable before using them, you dont declare their type as result variable can change their type of its value as much as you want.
Subscribe to:
Posts (Atom)
Starting to Learn Wordpress
I'm gonna start learning wordpress again. I know it's been a while and I'm using Blogger to write everything. I don't know...
-
Well if you don’t know what is Yii Framework. I recommend just go to the main site http://www.yiiframework.com And then http://www.yiiframe...
-
Read the first Part :: Contain the database and basic creating / generating models / crud CJUIDIALOG In these part 2 I will concentra...
-
im currently doing project using PHP 5 and MSSQL SERVER 2005. they use different server. one for web server and the other one is for Databas...