|
|
|
codepad
|
|
|
|
Saved pastes by php.programmer:
<?php
// SPL Iterators sample
foreach(spl_classes() as $key=>$value)
{
echo $key.' -> '.$value."\n";
|
| view (36 lines, 168 lines of output) |
<?php
// sample file and directory handling functions streams layer
if(is_dir('/'))
echo 'in dir';
else
|
| view (47 lines, 6 lines of output) |
<?php
// sample code to illustrate the use of exception class in oops to handle the errors
// this is very basic function , I will update this later.
// http://royads.blogspot.com
|
| view (35 lines, 7 lines of output) |
<?php
// classes and there objects can be iterated with the help of foreach
// simple iteration
class iteratorSample
{
|
| view (27 lines, 10 lines of output) |
<?php
// sample code for error handling - a custom error handling in php
// http://royads.blogspot.com
ini_set('display_errors', 'Off');
|
| view (46 lines, 7 lines of output) |
<?php
// easy and fast multiply integers by power of 2
$x = 4;
echo $x >> 1;
echo "\n";
|
| view (27 lines, 6 lines of output) |
<?php
// sample code to illustrate the use of singleton design pattern
// http://royads.blogspot.com
class mysqlClass
|
| view (32 lines, 1 line of output) |
<?php
// sample code to illustrate the use of factory design pattern
// Each class and the actual implementation logic can be in separate files.
// http://royads.blogspot.com
class mysqlClass
|
| view (52 lines, 2 lines of output) |
<?php
/* sample code to show the implementation of adapter design pattern
* http://royads.blogspot.com
*/
// This is my base class library with 2 basic methods
|
| view (51 lines, 1 line of output) |
<?php
/* sample code to show use of magic methods <b>__toString()</b>.
* http://royads.blogspot.com
*/
class stringTest
|
| view (22 lines, 5 lines of output) |
<?php
/* sample code of implementation of Member overloading with help of magic functions
* __set(), __get(), __isset(), __unset()
* author : http://royads.blogspot.com
*/
|
| view (44 lines, 7 lines of output) |
<?php
/* Sample code to show use of magic function __clone().
* author@ : http://royads.blogspot.com
* summery@ : clone is a keyword which call __clone() method. This method cant be called directly.
*/
|
| view (36 lines, 4 lines of output) |
<?php
// sample code to show the use of magic methods __construct and __destruct
// author@ : http://royads.blogspot.com
class parentClass
|
| view (32 lines, 5 lines of output) |
<?php
/* sample code to describe the flow of class
when we use __sleep() and __wakeup() methods with
serilize and unserilize objects.
*/
|
| view (51 lines, 15 lines of output) |
<?php
// sample code for variable functions in php5
function me($name)
{
return 'I am me name ='.$name;
|
| view (21 lines, 4 lines of output) |