Category Archive: PHP

Jun 07

Fibonacci Series in PHP

A Fibonacci Series of  Number (0,1,1,2,3,5,8,13,21,34,55……) A Fibonacci Series represent in Mathematical term. Fn=Fn-1+Fn-2; F0=0, F1=1 First two number of Fibonacci Series are 0 and 1. After that each number is sum of previous two number. Fibonacci Series was used in ancient india for metric science. It refered as ‘Golden Mean’ in roman. Some method …

Continue reading »

Mar 27

useful function in php

Sort This function use for sort an array. Element will arrange lowest to highest. Syntax bool Sort($array, sortingtype or flag) Sortingtype : Optional, specify how the compare element value 1. SORT_REGULAR : Default. Compare items normally. 2. SORT_NUMERIC : Compare items numerically 3. SORT_STRING : Compare items as strings 4. SORT_STRING : Compare items as strings 5. SORT_LOCALE_STRING : Compare items …

Continue reading »

Mar 21

Array Shift and Unshift

Array_Shift : Shift an element off the beginning of array. Syntax : array_shift ( $arrval ) array_shift() shifts the first value of the array off and returns it. Return the shift value or null if array is empty. Example: $arrval = array(“test”, “test1”, “test2”, “test3”); $shiftval = array_shift($arrval); print_r($arrval); Output: array( [0] => test1 [1] => test2 [2] …

Continue reading »

Mar 21

Array Push and Pop

Array_Push : Push one or more elements onto the end of array Syntax: array_push ( $array ,  $value1 [, $value2, $value3,… ] ) array_push() treats array as a stack, and pushes the passed variables onto the end of array. Simple example: $arr[]=$val; In Above Example return the new number of element in array. Example: $arrval=array(“test”,”test1″); array_push($arrval,”test3″,”test4″); print_r($arrval); Output Array ( [0] => test [1] => test1 …

Continue reading »

Older posts «

» Newer posts