background preloader

Php

Facebook Twitter

Tidy. Static Method Inheritance « phpInfo.php …. We know static methods are callable without instantiating objects. But if it is used from explicit class name, php violates inheritance rule by referencing the current class instead of the called class. Moreover if we use ‘self’ to call the method , it will represent the current class. To solve this limitation PHP introduce Late Static Binding (LSB) from PHP version 5.3.0 that can be used to reference the current class. It is represented as ‘static::’. So the above code will be as following Now the above code will output ChildClass::dump(), but ‘static::’ is available from PHP version 5.3.0 For more info please visit the following links Static Keyworkd Late Static Binding Thank$ $haymoL eXpLoRinG PHP Like this: Like Loading...

Regexp

Array_filter. Be careful with the above function "array_delete"'s use of the stristr function, it could be slightly misleading. consider the following: <? Php function array_delete($array, $filterforsubstring){ $thisarray = array (); foreach($array as $value) if(stristr($value, $filterforsubstring)===false && strlen($value)>0) $thisarray[] = $value; return $thisarray; } function array_delete2($array, $filterforstring, $removeblanksflag=0){ $thisarray = array (); foreach($array as $value) if(! (stristr($value, $filterforstring) && strlen($value)==strlen($filterforstring)) && ! (strlen($value)==0 && $removeblanksflag)) $thisarray[] = $value; return $thisarray; } function array_delete3($array, $filterfor, $substringflag=0, $removeblanksflag=0){ $thisarray = array (); foreach($array as $value) if( ! (stristr($value, $filterfor) && ($substringflag || strlen($value)==strlen($filterfor)) ) && !

Echo "<pre>array :\n"; print_r($array1); $array2=array_delete($array1, "Other");

RETS

View forum - Feature-requests. Bonfire - Jumpstart Your CodeIgniter Applications.