[ create a new paste ] login | about

php.programmer

Name: Roy
Email:
Site/Blog: http://royads.blogspot.com
Location:
Default language: PHP
Favorite languages: php
About: Leading a PHP development team in India.

Saved pastes by php.programmer:

PHP, pasted on May 17:
1
2
3
4
5
<?php
//zcephp5 new functions

// open this file
$fp = fopen(__FILE__, 'r');
...
view (16 lines, 4 lines of output)
PHP, pasted on May 14:
1
2
3
4
5
<?php
//zcephp5 operators
function cc($n)
{
 if($n>0)
...
view (15 lines, 1 line of output)
PHP, pasted on May 14:
1
2
3
4
5
<?php
// zcephp5 oops
class myclass
{
 function reassign($ref)
...
view (14 lines, 2 lines of output)
PHP, pasted on May 7:
1
2
3
4
5
<?php
// SPL Iterators sample
foreach(spl_classes() as $key=>$value)
{
  echo $key.' -> '.$value."\n";
...
view (36 lines, 168 lines of output)
PHP, pasted on May 6:
1
2
3
4
5
<?php
// sample file and directory handling functions streams layer 
if(is_dir('/'))
  echo 'in dir';
else
...
view (47 lines, 6 lines of output)
PHP, pasted on May 5:
1
2
3
4
5
<?php
// twist with php operators 
$var = 0 ;
echo $var++;
              echo PHP_EOL;
...
view (36 lines, 14 lines of output)
PHP, pasted on May 4:
1
2
3
4
<?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, pasted on Apr 29:
1
2
3
4
5
<?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, pasted on Apr 28:
1
2
3
4
5
<?php
// object is always passed by reference in php5
class mclass
{
 private $f;
...
view (21 lines, 2 lines of output)
PHP, pasted on Apr 23:
1
2
3
4
5
<?php

// sample code for showing how type hinting is used in php

class a
...
view (22 lines, 1 line of output)
PHP, pasted on Apr 20:
1
2
3
4
5
<?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, pasted on Apr 20:
1
2
3
4
5
<?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, pasted on Apr 16:
1
2
3
4
5
<?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, pasted on Apr 15:
1
2
3
4
5
<?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, pasted on Apr 15:
1
2
3
4
5
<?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, pasted on Apr 14:
1
2
3
4
5
<?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, pasted on Apr 14:
1
2
3
4
5
<?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, pasted on Apr 14:
1
2
3
4
5
<?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, pasted on Apr 14:
1
2
3
4
5
<?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, pasted on Apr 14:
1
2
3
4
5
<?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, pasted on Apr 13:
1
2
3
4
5
<?php
// sample code for variable functions in php5
function me($name)
{
 return 'I am me name ='.$name;
...
view (21 lines, 4 lines of output)
PHP, pasted on Apr 13:
1
2
3
4
5
<?php
// sample code for Variable-length argument lists kind of functions
function me($iAnmDefault='2')
{ 
  $arguments = func_get_args();
...
view (18 lines, 3 lines of output)