ABSPATH or BASEPATH +
In CMS ABSPATH and framework use BASEPATH is used to get root information in the form of defined variable . In the end with the help of both we get same accurate result.
array list ( mixed $var1 [, mixed $... ] ) +
$info = array('coffee', 'brown', 'caffeine'); // Listing all the variables list($drink, $color, $power) = $info; echo "$drink is $color and $power makes it special.\n"; // Listing some of them list($drink, , $power) = $info; echo "$drink has $power.\n"; // Or let's skip to only the third one list( , , $power) = $info; echo "I need $power!\n"; // list() doesn't work with strings list($bar) = "abcde";
list() - php.net
PHP Routing Explained+
array_key_properties+
Definition and Usage
array_key_exists(key,array)
The array_key_exists() function checks an array for a specified key, and returns true if the key exists and false if the key does not exist.
Check if the key "Volvo" exists in an array:
$a=array("Volvo"=>"XC90","BMW"=>"X5"); if (array_key_exists("Volvo",$a)) { echo "Key exists!"; } else { echo "Key does not exist!"; }
if you skip the key when you specify an array, an integer key is generated, starting at 0 and increases by 1 for each value.
Check if the key "Toyota" exists in an array:
$a=array("Volvo"=>"XC90","BMW"=>"X5"); if (array_key_exists("Toyota",$a)) { echo "Key exists!"; } else { echo "Key does not exist!"; }
property_exists+
(PHP 5 >= 5.1.0, PHP 7)
property_exists — Checks if the object or class has a property
bool property_exists ( mixed $class , string $property )
class myClass { public $mine; private $xpto; static protected $test; static function test() { var_dump(property_exists('myClass', 'xpto')); //true } } var_dump(property_exists('myClass', 'mine')); //true var_dump(property_exists(new myClass, 'mine')); //true var_dump(property_exists('myClass', 'xpto')); //true, as of PHP 5.3.0 var_dump(property_exists('myClass', 'bar')); //false var_dump(property_exists('myClass', 'test')); //true, as of PHP 5.3.0 myClass::test();
function_exists()+
method_exists+
(PHP 4, PHP 5, PHP 7)
method_exists — Checks if the class method exists
bool method_exists ( mixed $object , string $method_name )
$directory = new Directory('.'); var_dump(method_exists($directory,'read')); output: bool(true)
method_exists() - php.net
class_exists()+
foreach()+
The foreach construct provides an easy way to iterate over arrays. foreach works only on arrays and objects, and will issue an error when you try to use it on a variable with a different data type or an uninitialized variable. There are two syntaxes:
foreach (array_expression as $value) statement foreach (array_expression as $key => $value) statement
The first form loops over the array given by array_expression. On each iteration, the value of the current element is assigned to $value and the internal array pointer is advanced by one (so on the next iteration, you'll be looking at the next element).
The second form will additionally assign the current element's key to the $key variable on each iteration.
It is possible to customize object iteration.
foreach() - php.net
implode()+
(PHP 4, PHP 5, PHP 7)
implode — Join array elements with a string
$arr = array('Hello','World!','Beautiful','Day!'); echo implode(" ",$arr)."<br>"; echo implode("+",$arr)."<br>"; echo implode("-",$arr)."<br>"; echo implode("X",$arr); results: Hello World! Beautiful Day! Hello+World!+Beautiful+Day! Hello-World!-Beautiful-Day! HelloXWorld!XBeautifulXDay!