code
stringlengths
1
2.01M
language
stringclasses
1 value
<?php //error_reporting(~E_STRICT); class Car { #following method should be static public function kmToMile($km) { return $km/1.5; } } echo Car::kmToMile(150); echo "\n",'Still I am running :)',"\n\n";
PHP
<?php #error_reporting(~E_NOTICE); echo $var; echo "\n",'Still I am running :)',"\n\n";
PHP
<?php //error_reporting(~E_DEPRECATED); $name = "vikas dwivedi's"; echo mysql_escape_string($name); //echo mysql_real_escape_string($name); echo "\n",'Still I am running :)',"\n\n";
PHP
<?php //error_reporting(~E_WARNING); echo 25/0; echo "\n",'Still I am running :)',"\n\n";
PHP
<hr> Debug : <hr> <?php foreach ($arrLog as $log) { echo $log; }
PHP
<?php require_once('db.php'); session_destroy(); header('location:'.SITE_PATH); exit;
PHP
<?php session_start(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta name="Author" content="Jos...
PHP
<?php session_start(); define('SITE_PATH','http://localhost/nb158jk/mysql_new'); date_default_timezone_set('Asia/Kolkata'); $isPrint = true; $arrLog = array(); // true => want to print // false => don't want to print $userName = 'root'; $password = ''; $host = 'localhost'; $dbName = 'nb158jk'; ...
PHP
<?php require_once('../db.php'); $usersQuery = "SELECT * FROM `users`"; pq($usersQuery); $usersResult = mysql_query($usersQuery) or die(mysql_error()); ?> <table border="1" cellpadding="0" cellspacing="0" width="80%" align="center"> <thead> <tr> <th colspan="6">:: All Users ::</th> </tr> <...
PHP
<?php require_once('../db.php'); $id = isset($_REQUEST['id'])?$_REQUEST['id']:0; if(isset($_POST['uname']) && !empty($_POST['uname'])) { $_POST = array_map('mysql_real_escape_string',$_POST); $_POST = array_map('strip_tags',$_POST); $_POST = array_map('trim',$_POST); pr($_POST); #################...
PHP
<?php require_once('../db.php'); $usersQuery = "SELECT * FROM `users`"; pq($usersQuery); $usersResult = mysql_query($usersQuery) or die(mysql_error()); ?> <table border="1" cellpadding="0" cellspacing="0" width="80%" align="center"> <thead> <tr> <th colspan="6">:: All Users ::</th> </tr> <...
PHP
<?php require_once('../db.php'); pr($_GET); if(isset($_GET['mode'])=='del'){ $id = $_GET['id']; $delQuery = "DELETE FROM `users` WHERE `id`='$id'"; pq($delQuery); mysql_query($delQuery) or die(mysql_error()); if(mysql_affected_rows()==1){ echo "User deleted successfully."; } } ...
PHP
<?php require_once('../db.php'); require_once('../header.php'); pr($_GET); // searching Start if(isset($_GET['search']) && !empty($_GET['search'])) { $search = $_GET['search']; $where = "WHERE `uname` LIKE '%$search%'"; } else { $search = ''; $where = ''; } // search end // Sort...
PHP
<?php require_once('./db.php'); require_once('./header.php'); // searching Start if(isset($_GET['search']) && !empty($_GET['search'])) { $search = $_GET['search']; $where = "WHERE `uname` LIKE '%$search%'"; } else { $search = ''; $where = ''; } // search end $usersQuery = "SELECT ...
PHP
<?php require_once('thumbnail/image.class.php'); $img = new Zubrag_image; $img->max_x = 100; $img->max_y = 100; $img->GenerateThumbFile($dest, "$thumb_dir/$fileName");
PHP
<?php // REQUIREMENTS: // PHP 4.0.6 and GD 2.0.1 or later // May not work with GIFs if GD2 library installed on your server // does not support GIF functions in full // Parameters: // src - path to source image // dest - path to thumb (where to save it) // x - max width // y - max height // q - quality (app...
PHP
<?php ############################################################### # Thumbnail Image Class for Thumbnail Generator ############################################################### # For updates visit http://www.zubrag.com/scripts/ ############################################################### class Zubrag...
PHP
<?php //echo '<pre>'; //print_r($_SESSION); //echo '</pre>'; if(!isset($_SESSION['id']) || empty($_SESSION['id'])) { header('location:'.SITE_PATH); exit; } ?> <div class="header_container"> <div class="header_left"> <ul class="header"> <li><a href="">Home</a></li> <li><a href="">Add New Us...
PHP
<?php require_once('./db.php'); require_once('./header.php'); // searching Start if(isset($_GET['search']) && !empty($_GET['search'])) { $search = $_GET['search']; $where = "WHERE `uname` LIKE '%$search%'"; } else { $search = ''; $where = ''; } // search end $usersQuery = "SELECT...
PHP
<?php require_once('./db.php'); $_POST = array_map('mysql_real_escape_string',$_POST); $_POST = array_map('strip_tags',$_POST); $_POST = array_map('trim',$_POST); pr($_POST); $_POST['added_date'] = date('Y-m-d H:i:s'); $_POST['status'] = '1'; $insertQuery = "INSERT INTO `users` SET "; foreach($_PO...
PHP
<?php require_once('./db.php'); pr($_POST); $_POST['added_date'] = date('Y-m-d H:i:s'); $_POST['status'] = '1'; $insertQuery = "INSERT INTO `users` SET "; foreach($_POST as $colName=>$value) { $insertQuery .= "`$colName`='$value' ,"; } $insertQuery = rtrim($insertQuery,' ,'); mysql_query($insertQ...
PHP
<?php require_once('./db.php'); require_once('./header.php'); pr($_FILES); $flag = false; $msg = ''; if(isset($_FILES['csvfile']['error']) && $_FILES['csvfile']['error']==0 ) { if($_FILES['csvfile']['type']=='application/vnd.ms-excel' ) { $src = $_FILES['csvfile']['tmp_name']; $dest = './...
PHP
<?php require_once('../db.php'); pr($_POST); pr($_FILES); $msg = ''; $validExtn = array('png', 'jpeg', 'jpg', 'gif' ); if(isset($_FILES['avatar']['error']) && $_FILES['avatar']['error']==0) { $fileName = $_FILES['avatar']['name']; pr($fileName); $f...
PHP
<?php require_once('../db.php'); pr($_POST); pr($_FILES); $msg = ''; $validExtn = array('png', 'jpeg', 'jpg', 'gif' ); $mb = 1; $allowedFileSize = $mb * 1024 * 1024; $uploadDir = './uploads'; if(isset($_FILES['avatar']['error']) && $_FILES['avatar']...
PHP
<!-----------------------------------> <hr> Debug : <hr> <?php foreach ($arrLog as $log) { echo $log; }
PHP
<?php require_once('./db.php'); require_once('./header.php'); $msg = ''; if(isset($_POST['uname']) && !empty($_POST['uname'])) { if($_POST['captcha'] == $_SESSION['secretword']) { // we don't need to save captcha in db unset($_POST['captcha']); ##############################################3 $...
PHP
<?php require_once("db.php"); $msg = ''; //echo '<pre>'; //print_r($_COOKIE); if(isset($_SESSION['id']) || !empty($_SESSION['id'])) { header('location:'.SITE_PATH.'/display_users/index.php'); exit; } if(isset($_POST['email']) && !empty($_POST['email']) && isset($_POST['password']) && !empty($_...
PHP
<?php $email = array ( 0 => 'hello1@gmail.com', 1 => '" hello2@gmail.com "', 11 => 'hello2@gmail.com', 2 => 'hello3@gmail.com', 22 => '', 3 => 'hello4@gmail.com', 4 => '" hello5@gmail.com "', 44 => '0', 5 => 'hello6@gmail.com', 5 => false, 66 => 'hello7@gmail.com', 6 => null, 666...
PHP
<?php // define array $arr = range(21,50); print_r($arr);
PHP
<?php // define array $data = array('Monday', 'Tuesday', 'Wednesday'); // get array size echo 'The array has ' . count($data) . ' elements';
PHP
<?php //echo date_default_timezone_get(); date_default_timezone_set('Asia/Kolkata'); echo date('Y-m-d H:i:s a l'); echo "\n\n";
PHP
<?php // define array $cars = array ( 0 => 'Ferrari', 389 => 12345, 390 => false, 45 => 123.456, 391 => 'Mercedes', 'eshan'=>'php' ); print_r($cars); var_export($cars); var_dump($cars); //exit; //exit(); //exit("I am exit\n\n"); //die; //die(); //die("I am die\n\n");
PHP
<?php $a = 123; var_dump(isset($a)); var_dump(empty($a)); var_dump(isset($x)); $m = ''; var_dump(isset($m)); var_dump(empty($m)); unset($m); var_dump(isset($m));exit;
PHP
<?php echo "<pre>"; // define array $cities = array ( 0 => 'London', 1 => 'Paris', 2 => 'Barcelona', 'United States' => 'Lisbon', 4 => 'Zurich', ); print_r($cities); // search array for value $a = array_search('Lisbon', $cities); var_dump($a);exit; $b = array_search( 'Barcelona', $cities); var...
PHP
<?php // define arrays $orange = array('red', 'yellow'); $green = array('yellow', 'blue'); // find common elements // output: ('yellow') $common = array_intersect($orange, $green); print_r($common); // find elements in first array but not in second // output: ('red') $unique = array_diff($orange,$green); ...
PHP
<?php $string ='1 HOUR'; echo $t1 = strtotime($string); echo "<br>\n"; $string ='2 HOUR'; echo $t2 =strtotime($string); echo "<br>\n"; echo $t2-$t1;
PHP
<?php $dark = array ( 0 => 'black', 11 => 'brown', 2 => 'blue', // 33 => 'violet', 'lang'=>'symphony' ); $light = array ( 0 => 'white', 11 => 'silver', 2 => 'yellow', 'lang'=>'cake_php' ); //$php = array('lang'=>'zend'); $colors = array_merge($dark, $light); $combinedColors = arra...
PHP
<?php echo '<pre>'; // define arrays $dark = array( 'alpha'=>'black', 1 => 'brown1', 2 => 'brown134s', 'bravo'=> 'brown2', 'charlie'=>'blue'); $light = array( 'alpha'=>'white', 1 =>'silver1', 'bravo'=>'silver...
PHP
<?php // define array $duplicates = array('a', 'b', 'a', 'c', 'e', 'd', 'e'); // remove duplicates // output: ('a', 'b', 'c', 'e', 'd') $uniques = array_unique($duplicates); print_r($uniques); ?>
PHP
<?php $email = array ( 0 => 'hello1@gmail.com', 1 => '" hello2@gmail.com "', 11 => 'hello2@gmail.com', 2 => 'hello3@gmail.com', 22 => '', 3 => 'hello4@gmail.com', 4 => '" hello5@gmail.com "', 44 => '0', 5 => 'hello6@gmail.com', 5 => false, 66 => 'hello7@gmail.com', 6 => null, '...
PHP
<?php // define array $movies = array ( 10 => 'The Lion King', 111 => 'Cars', 2 => "A Bug\"s Life", ); print_r($movies); // remove element from beginning of array array_shift($movies); print_r($movies); // remove element from end of array array_pop($movies); print_r($movies); // add element ...
PHP
<?php $profile = array( "fname" => "Susan", "lname" => "Doe", "gender" => "female", "sector" => "Asset Management", "one" => "1Hello", "eleven" => "11Hello", "two" => "2", "five" => "5" ); natsort($profile); print_r($profile);
PHP
<?php // define array $profile = array( "fname" => "Susan", "lname" => "Doe", "sex" => "female", "sector" => "Asset Management" ); // sort by value // output: ('sector' => 'Asset Management', // 'lname' => 'Doe', // 'fname' => 'Susan', // 'sex' => 'female') krsort($profile); print_r($profile)...
PHP
<?php // define array $rainbow = array( 'a'=>'violet', 'b'=>'indigo', 'c'=>'blue', 'd'=>'green', 'e'=>'yellow', 'f'=>'orange', 'g'=>'red'); // randomize array shuffle($rainbow); print_r($rainbow); echo ($rai...
PHP
<?php // define array $rainbow = array('violet', 'indigo', 'blue', 'green', 'yellow', 'orange', 'red'); // reverse array // output: ('red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet') $arr = array_reverse($rainbow); print_r($arr);
PHP
<?php // define array $data = array( 15, 81,14,74,2); // sort and print array // output: (2,14,15,74,81) sort($data); print_r($data); ?>
PHP
<?php //$cars = array(); // define array $cars[1] = 'Ferrari'; $cars[2] = 'Porsche'; $cars[367] = 'Jaguar'; $cars[] = 'Lamborghini'; $cars[0] = 'Mercedes'; $cars[7] = 'Deepak'; $cars[] = 'Maruti'; $cars[2] = 'Bajaj'; print_r($cars);
PHP
<?php // output: '12 Nov 07' //echo date('d M y', strtotime('now')); // output: '13 Nov 07' //echo date('d M y', strtotime('tomorrow')); // output: '16 Nov 07' echo date('d M y', strtotime('next Friday'));exit; // output: '10 Nov 07' //echo date('d M Y H:i:s', strtotime('48 hours ago')); ?>
PHP
<?php // define array $cities = array( "France" => "Paris", "India" => "Delhi", "Nepal"=>NULL ); // search array for key $a = array_key_exists('Nepal', $cities); var_dump($a); $a = isset($cities['Nepal']); var_dump($a); exit; ////////////////////////////////////////// $a = array_key_exists('N...
PHP
<?php // define array $meats = array( 'fish', 'chicken', 'ham', 'lamb' ); //print_r($meats); // remove 'fish' unset($meats[2]); print_r($meats); var_dump(isset($meats[2])); var_dump(isset($meats)); ////////////////// Check for empty() $a = NULL; var_dump(empty($a));
PHP
<?php // define array $data = array( 'username' => 'john', 'password' => 'secret', 'host' => '192.168.0.1', 'php'=>array( 'framework'=>array('zend','cake'), 'cms'=>array('wordpress','joomla') ), 'version'=>5, 'price'=>500.45, 'isValid'=>false ); //echo j...
PHP
<?php echo "<pre>"; // define array $rainbow = array('violet', 'indigo', 'blue', 'green', 'yellow', 'orange', 'red'); $arr = array_slice($rainbow, 2,2); print_r($arr);
PHP
<?php $a = " 'Hello' "; var_dump($a);echo '<br>'; var_dump(ltrim($a));echo '<br>'; var_dump(rtrim($a));echo '<br>'; var_dump(trim($a));echo '<br>'; var_dump(trim($a,"' "));echo '<br>';
PHP
<?php // define array $arr = array ( 0 => 'one', 1 => 'two', 2 => 'three', 3 => 'four', ); // convert array to string // output: 'one and two and three and four' echo $str = implode( ' and ', $arr); echo "\n\n"; // define string $str = 'tinker, and *tailor, and *soldier, and *spy'; // conve...
PHP
<?php var_dump(isset($a));//bool(false) $a = "Hello"; var_dump(isset($a));// bool(true) unset($a); var_dump(isset($a));//bool(false) echo "<br>========== EMPTY ===========<br>"; $b = ''; $c = NULL; $d = false; $e = '0'; $f = 'hello'; var_dump(empty($b)); var_dump(empty($c)); var_dump(empty($d)); var_dump(empty($e)...
PHP
<?php echo "<pre>"; // define array $rainbow = array('violet', 'indigo', 'blue', 'green', 'yellow', 'orange', 'red'); // extract 3 central values // starting from the end // output: ('blue', 'green', 'yellow') $arr = array_slice($rainbow, -5, 13); print_r($arr);
PHP
<?php // define array $meats = array ( 0 => 'fish', 1 => 'chicken', 2 => 'ham', 3 => 'lamb', ); // change 'ham' to 'turkey' $meats[2] = 'turkey'; var_export($meats);
PHP
<?php $data['username']['john'] = 'scott'; $data['username']['maria'] = 'tiger'; print_r($data);
PHP
<?php // define array $arr = array(7, 36, 5, 48, 28, 90, 91, 3, 67, 42); // get min and max // output: 'Minimum is 3 and maximum is 91' echo 'Minimum is ' . min($arr) . ' and maximum is ' . max($arr);
PHP
<?php // define array $cities = array( "United Kingdom" => "London", "United States" => "Washington", "France" => "Paris", "India" => "Delhi" ); //$newArray = array_slice($cities,1,2); //print_r($newArray); //exit; // iterate over array // print each value foreach ($cities as $key5=>$value) { ...
PHP
<?php date_default_timezone_set('Asia/Kolkata'); echo date('Y-m-d H:i:s', strtotime('+70Minutes')); echo "\n\n\n"; exit; //$seconds = 3600*24*365*43; //echo date('Y-m-d H:i:s', $seconds); //echo date('Y-m-d H:i:s', time()); //echo "<br>"; //echo date('Y-m-d H:i:s', time()+(60*60*24*7)); echo "\n"; ...
PHP
<?php // define string containing date value // convert it to UNIX timestamp // re-format it using date() // output: '07 Jul 08' date_default_timezone_set('Asia/Kolkata'); //$str = 'Jan 1 1970 2:00:05'; $str = 'Nov 25 2012 2:25:15'; $str = '25 Nov 2012 2:25:15'; $str = '25 11 2012 2:25:15'; $str = '25-11-201...
PHP
<?php include '../../a.php'; include '3/c.php'; include '../../a.php'; include '3/c.php'; include '../../a.php'; include '3/c.php'; echo __FILE__ ,"->", __LINE__ ,"\n\n"; echo $a,' ',$c,"\n\n";
PHP
<?php $c = 'world'; echo __FILE__ ,"->", __LINE__ ,"\n\n";
PHP
<?php $a = 'Hello'; echo __FILE__ ,"->", __LINE__ ,"\n\n";
PHP
<?php /** * Requirement : * If any string contain * 1. Single Quotes (') * 2. Double Quotes (") * 3. Backslash (\) * Then those special characters should not be read by compiler or cn say must be Stripped by * complier. **/ $str = "This is ravi's book" ; echo $newStr = addslashes($str); echo "\n-...
PHP
<?php echo rand(100000,999999); echo "\n\n"; echo rand(100000,999999); echo "\n\n"; echo rand(100000,999999); echo "\n\n"; echo rand(100000,999999); echo "\n\n"; echo rand(100000,999999); echo "\n\n"; echo "\n----------------\n"; echo uniqid(); echo "\n\n"; echo uniqid(); echo "\n\n"; echo uniqid(); echo "\n\n"; echo u...
PHP
<?php // replace with HTML entities // output: '&lt;div width=&quot;200&quot;&gt; // This is a div&lt;/div&gt;' $abc = "<script>alert('hello')</script>"; echo htmlentities($abc); echo "<hr>"; exit; echo strip_tags($abc); echo "\n"; $html = '<div width="200" style="border:1px red solid">This is a div</div>';...
PHP
<?php // requirement : If sometime calculation goes wrong , but we don't require to show // negative sign $num = -23.68; echo __LINE__."->".abs($num); echo "\n"; echo __LINE__."->".round($num); echo "\n"; echo __LINE__."->".round($num,1); echo "\n"; echo __LINE__."->".ceil($num); echo "\n"; echo __LINE__....
PHP
<?php $string = 'Weekend php'; $length = strlen($string); for ($i=($length-1) ; $i >= 0 ; $i--) { echo $string[$i]; } //php dnekeeW $string = 'Weekend php'; $i=0; $newArr = array(); while(isset($string[$i])) { array_unshift($newArr,$string[$i]); $i++; } print_r($newArr); echo implode($newArr); echo "\n\n"; e...
PHP
<?php $string = "weekend php for php"; /* * String Length * */ $strLen = strlen($string); echo "The length of string is $strLen"; echo "\n\n------------\n\n"; var_dump($string); echo "\n\n------------\n\n"; /* * Replace php with zend * */ $newString = str_replace('php',...
PHP
<?php // strip HTML tags from string // output: 'Please log in again' echo $html = '<div width="200" style="color:red;border:1px solid blue;">Please <strong>log in again</strong></div>'; echo "\n<br>"; echo strip_tags($html);
PHP
<?php $arr = array( 'india'=>'delhi', 'srilanka'=>'colombo', 'us'=>false, 'uk'=>null, 'china'=>'' ); var_dump(isset($arr['pak'])); var_dump(isset($arr['china'])); var_dump(isset($arr['uk'])); var_dump(array_key_exists('uk',$arr)); var_dump(array_key_...
PHP
<?php // 4 cases when string is treated as empty // Case 1 $str = ''; var_dump(empty($str));// output: true // Case 2 $str = null; var_dump(empty($str));// output: true // Case 3 $str = '0'; var_dump(empty($str));// output: true $str = 'hello'; // Case 4 unset($str); var_dump(empty($str));// outpu...
PHP
<?php // Requirement // *Used in Paging script $num = 19.7; echo floor($num); // 19 echo ceil($num); // 20
PHP
<?php $string = 'mAkE iT uPpEr oR LoWeR'; // LowerCase Of string echo strtolower($string); // make it upper or lower echo "\n<br>"; // UpperCase Of string echo strtoupper($string); // MAKE IT UPPER OR LOWER echo "\n<br>"; // 1st letter of every word UpperCase Of string echo ucwords($string); // MAkE IT UPpEr...
PHP
<?php // remove leading and trailing whitespace // output: 'a b c' $str = ' #Hello world# '; var_dump($str); $str1 = trim($str,' #o'); var_dump($str1);
PHP
<?php // Requirement : // *can use to rename file while uploading // *can also use to send system generated password through email while registration. $num = rand(); var_dump(__LINE__ ."->".$num); echo "\n<br>"; // If our range is specific then we can also use $num = rand(100,110); var_dump(__LINE__ ."...
PHP
<?php $str = 'This is Hello World of String'; // 1. Length of string echo strlen($str); // 29 // 2. Want to repeat aany string several times echo '<br>'; $str = "Yes"; echo str_repeat($str, 3); //Yes Yes Yes // 3. very common function // used to replace any string in hayStack echo '<br>'; $str = '...
PHP
<?php date_default_timezone_set("Asia/Calcutta"); echo date("ymdhis").uniqid(); echo "\n\n";
PHP
<?php $number = 123456789.87654; echo number_format($number,3); echo "\n\n"; echo number_format($number, 3, '@' ,'#'); echo "\n\n";
PHP
<?php //<script>alert('You are hacked !!')</script> //<script>window.location='http://google.com'</script> if(isset($_POST['comment'])) { $comment = trim($_POST['comment']); echo $comment ; //echo htmlentities($comment) ; } ?> <form name="testData" action="" method="post"> <textarea name="comment"></texta...
PHP
<?php echo time(); echo "\n\n"; echo time(); echo "\n\n"; echo time(); echo "\n\n"; echo time(); echo "\n\n";
PHP
<?php // remove leading and trailing whitespace // output: 'a b c' $str = '" Hello Php "'; var_dump($str); $str1 = trim($str,'#'); var_dump($str1); $str1 = trim($str,'" '); var_dump($str1);
PHP
<?php include '../../a.php'; include '3/c.php'; include '../../a.php'; include '3/c.php'; echo __FILE__ ,"->", __LINE__ ,"\n\n"; echo $a,' ',$c,"\n\n";
PHP
<?php $c = 'world'; echo __FILE__ ,"->", __LINE__ ,"\n\n";
PHP
<?php $a = 'Hello'; echo __FILE__ ,"->", __LINE__ ,"\n\n"; function checkData(){ return true; }
PHP
<?php include_once('unknown.php'); echo "\n\n",'Still I am running',"\n\n"; require_once('missing.php'); echo "\n\n",'You can not catch me!! :P',"\n\n";
PHP
<?php $b = md5(1); var_dump($b); $b = md5("This is hello and world in php"); var_dump($b);
PHP
<?php $a = urlencode('http://google.com?name=zeev ssuraski&key=1@#$"-'); var_dump($a); var_dump(urldecode($a));
PHP
<?php $b = base64_encode(1); var_dump($b); $c = base64_decode($b); var_dump($c); echo "\n------------------\n"; $b = base64_encode("This is hello and world in php"); var_dump($b); $c = base64_decode($b); var_dump($c); echo "\n------------------\n";
PHP
<?php $b = sha1(1); var_dump($b); $b = sha1("This is hello and world in php"); var_dump($b);
PHP
<?php $arr = array ( 'framework' => array ( 0 => 12, 1 => 35, 2 => 67, ), 'cms' => array ( 0 => 1, 1 => 77, ), ); parseMulti...
PHP
<?php $flag = mail('nb158f@gmail.com','Test Email','THis is my email body'); var_dump($flag);
PHP
<?php $headers = 'MIME-Version: 1.0' . "\r\n"; //$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // Additional headers $headers .= 'To: PHP Noida <nb158f@gmail.com>' . "\r\n"; $headers .= 'From: vikas <vikas.nice@gmail.com>' . "\r\n"; //$headers .= 'Cc: birthdayarchive@example.com' . "\r\n"; //$...
PHP
<?php class Car { private $speed=333; private $email='test@gmail.com'; function getSpeed() { return $this->email; } function setSpeed($speed = 0) { $this->speed = $speed; } } $maruti = new Car; //echo $maruti->speed; //$maruti->setSpeed(2345); echo $maruti->getSpeed(); echo "\n\n\n";
PHP
<?php class User { public function __call($arg1,$arg2) { echo __LINE__ , "\n\n"; echo "The function ($arg1) you are calling doesn't exists\n\n"; } public static function __callStatic($arg1,$arg2) { echo __LINE__ , "\n\n"; echo "The static function ($arg1) you are calling doesn't exists\n\n"...
PHP
<?php class User { public function __construct() { echo __LINE__ , "\n\n"; } public function user() { echo __LINE__ , "\n\n"; } public function __destruct() { echo __LINE__ , "\n\n"; } } $vikas = new User;
PHP
<?php class PropertyTest { private $data = array(); /** Location for overloaded data. */ public $declared = 1; /** Overloading not used on declared properties. */ private $hidden = 2; /** Overloading only used on this when accessed outside the class. */ public function __set($name, $value) { ...
PHP
<?php class User { function __sleep() { echo __LINE__ , "\n\n"; return array(); } function __wakeup() { echo __LINE__ , "\n\n"; } } $amit = new User; $str = serialize($amit); var_dump($str); unserialize($str);
PHP