This function displays structured information about one or more expressions that includes its type and value. Arrays and objects are explored recursively with values indented to show structure. <?php $a = array(1, 2, array(“a”, “b”, “c”)); var_dump($a); ?> Result : – array(3) { [0]=> int(1) [1]=> int(2) [2]=> array(3) { [0]=> string(1) “a” [1]=> string(1) [...]
Archive for the ‘PHP’ Category
<?php $text = ” Hello “; $textlen = strlen($text); echo “Text is : $text \n”; echo “Text length before trim : $textlen \n”; $text = trim($text); $textlen = strlen($text); echo “Text length after trim : $textlen \n”; ?> Result: – Text is : Hello Text length before trim : 7 Text length after trim : [...]
PHP array_count_values($arr)
Posted: January 3, 2010 in Array, PHPTags: array, array_count_values($arr), PHP
array_count_values($arr) creates a histogram for the values in an array <?php $states = array(“MP”,”AP”,”RJ”,”UP”,”MH”,”HM”,”AP”,”RJ”,”MP”,”MH”,”AP”); $xstates = array_count_values($states); ksort($xstates); print_r($xstates); ?> Result: – Array ( [AP] => 3 [HM] => 1 [MH] => 2 [MP] => 2 [RJ] => 2 [UP] => 1 )
PHP is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML.
<?php $obj = new NumberToString(); $z = array(); for ($i = 0; $i<=1000; $i++) { $z[] = $obj->ConvertNumber($i); } print_r($z); class NumberToString { private static $arrNumber; private static function GenerateArray() { $arr['0'] = “Zero”; $arr['1'] = “One”; $arr['2'] = “Two”; $arr['3'] = “Three”; $arr['4'] = “Four”; $arr['5'] = “Five”; $arr['6'] = “Six”; $arr['7'] = “Seven”; [...]

