Skip to content
Snippets Groups Projects
Commit d0f56e38 authored by dharaneesh . r ravi's avatar dharaneesh . r ravi
Browse files

introduction to oops

parent ff2e4a1c
No related branches found
No related tags found
No related merge requests found
<?php
$signup = false;
if (isset($_POST['username']) and isset($_POST['password']) and isset($_POST['email_address']) and isset($_POST['phone'])) {
if (isset($_POST['username']) and !empty($_POST['username']) and isset($_POST['password']) and !empty($_POST['password']) and isset($_POST['email_address']) and !empty($_POST['email_address']) and isset($_POST['phone']) and !empty($_POST['phone'])) {
$username = $_POST['username'];
$password = $_POST['password'];
$email = $_POST['email_address'];
......
<?php
/**
*public
*private
*protected
*/
class Mic {
private $brand;
public $color;
public $usb_port;
public $model;
public $price;
public $light;
public function __construct($brand) {
printf("constructing object ....");
$this->brand = $brand;
}
public function getbrand() {
return $this->brand;
}
public function setlight($light) {
print ($light);
print ($this->light);
}
private function getmodel() {
return $this->model;
}
public function setmodel($model) {
$this->model = ucwords($model);
}
public function getmodelprox() {
return $this->getmodel();
}
}
<?php
//including the class function
include_once "includes/Mic.class.php";
//this function load all the file
function load_templates($name) {
// print("including $name.php");
......
<?php
include "libs/load.php";
// print("_SERVER\n");
......@@ -12,9 +11,20 @@ include "libs/load.php";
// print("_COOKIE\n");
// print_r($_COOKIE);
// testing the signup function
if (signup("sam", "password", "sam@123", "6369239993")) {
echo "success";
} else {
echo "fail";
}
// if (signup("sam", "password", "sam@123", "6369239993")) {
// echo "success";
// } else {
// echo "fail";
// }
$mic1 = new Mic("\nroda\n"); //constructing the object
$mic2 = new Mic("hyper\n"); //constructing the object
// $mic1->brand ="roda\n";
// $mic2->brand="hyper\n";
// print($mic1->brand);
// print($mic2->brand);
// $mic1->light="rgb\n";
// $mic1->setlight("white\n");
// $mic1->setmodel("welcome to all");
// print("model of 1st mic is".$mic1->getmodelprox());
print ("the brand of mic1" . $mic1->getbrand());
?>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment