simple class example in php


simple class example in php

<?php
class Customer {
public $name;

public function setName($name) {
$this->name = $name;
}

public function getName() {
return $this->name;
}
}

$c = new Customer();
$c->setName("Sunil Bhatia");
echo $c->name; // this will work as it is public.
$c->name = "New Name" ; //
?>

How can remove duplicate values from an array php

You can use array_unique function in php


<?php
$value 
= array("test","test1","test2","test"); $value array_unique($value); print_r($value); ?> 


Outputs:

Array
(
[0] => test
[1] => test1
[2] => test2
)

how can get current time in mysql

how can get current time in mysql


NOW() using in query u can get current time...


<?php
$update 
mysql_query("UPDATE test SET lastlogin = NOW() WHERE username = 'test'"); ?>