Found 1060 Articles for PHP

call_user_method_array() function in PHP

Samual Sam
Updated on 24-Jun-2020 12:49:22

153 Views

The call_user_method_array() function call a user method given with an array of parameters.Note − The function is deprecated now.Syntaxcall_user_method_array(method, obj, params)Parametersmethod − Method nameobj − Object that method is being called on.params − Array of parametersAlternativeSince the call_user_method_array() deprecated in PHP 4.1.0, and removed in PHP 7.0, therefore use the following as an alternative solution −call_user_func_array(array($obj, $method), $params);

uksort() function in PHP

Chandu yadav
Updated on 24-Jun-2020 12:45:49

85 Views

The uksort() function sorts an array by keys using a user-defined function. It returns TRUE on success and FALSE on failure.Syntaxuksort(arr, custom_function)Parametersarr − The specified array.custom_function − The comparison function. It must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second.ReturnThe uksort() function returns TRUE on success and FALSE on failure.ExampleThe following is an example − Live DemoOutputKey=a Value=99 Key=b Value=27 Key=c Value=56

prev() function in PHP

Chandu yadav
Updated on 30-Jul-2019 22:30:23

105 Views

The prev() function rewinds the internal array pointer. It outputs the previous element in the array. Syntax prev(arr) Parameters arr − The specified array. Required. Return The pos() function returns the value of the previous element in an array. Example The following is an example − Live Demo Output one two one

array_pad() function in PHP

Chandu yadav
Updated on 23-Dec-2019 08:50:44

478 Views

The array_pad() function inserts a specified number of items, with a specified value, to an array. It returns array with new elements. If size is positive then the array is padded on the right, if it's negative then the padding is done on the left.Syntaxarray_pad(arr, size, value)Parametersarr − the arraysize − total elements in the resultant arrayvalue − the value to pad and it should be less than the size of arrReturnThe array_pad() function returns array with new elements. If size is positive then the array is padded on the right, if it's negative then the padding is done on ... Read More

realpath_cache_size() function in PHP

karthikeya Boyini
Updated on 24-Jun-2020 09:31:33

115 Views

The realpath_cache_size() function returns realpath cache size i.e. the amount of memory.Syntaxrealpath_cache_size()ParametersNAReturnThe realpath_cache_size() function returns the amount of memory realpath cache is using.Example Live DemoOutput362

realpath_cache_get() function in PHP

Samual Sam
Updated on 24-Jun-2020 09:31:52

126 Views

The realpath_cache_get() function returns realpath cache entries. It returns an array of realpath cache entries.Syntaxrealpath_cache_get()ParametersNAReturnThe realpath_cache_get() function returns an array of realpath cache entries.Example Live DemoOutputArray ( [/home] => Array ( [key] => 4353355791257440477 [is_dir] => 1 [realpath] => /home [expires] => 1538630044 ) [/home/cg/root] => Array ( [key] => 1131813419205508649 [is_dir] => 1 [realpath] => /home/cg/root [expires] => 1538630044 ) [/home/cg/root/8944881/main.php] => Array ( [key] => 584844883037958768 [is_dir] => [realpath] => /home/cg/root/8944881/main.php [expires] => 1538630044 ) [/home/cg] => Array ( [key] => 9037225891674879750 [is_dir] => 1 [realpath] => /home/cg [expires] => 1538630044 ) [/home/cg/root/8944881] => Array ( [key] => 722006552431300374 [is_dir] => 1 [realpath] => /home/cg/root/8944881 [expires] => 1538630044 ) )

parse_ini_string() function in PHP

karthikeya Boyini
Updated on 24-Jun-2020 09:25:58

168 Views

The parse_ini_string() function parses a configuration string. The function returns the settings as an associative array on success. It returns FALSE on failure.Syntaxparse_ini_string(file_path, process_sections)Parametersfile_path − The ini file to be parsed.process_sections − If set to TRUE, you will get a multidimensional array with section names and settings included.ReturnThe parse_ini_string() function returns the settings as an associative array on success. It returns FALSE on failure.Let’s say the content of our “demo.ini” is −[names] one = Anne [urls] host1 = "https://www.example1.com"ExampleOutputArray ( [one] => Anne [host1] => https://www.example1.com )Read More

glob() function in PHP

Samual Sam
Updated on 24-Jun-2020 08:57:19

2K+ Views

The glob() function returns an array of filenames or directories matching a specified pattern. The glob() function returns.An array containing the matched files/directories, Returns an empty array if no file is matched, FALSE on error.Syntaxglob(pattern, flags)Parameterspattern − The pattern to search for.flags − The following are the flags:GLOB_MARK - Adds a slash to each item returnedGLOB_NOSORT - Return files as they appear in the directory (unsorted)GLOB_NOCHECK - Returns the search pattern if no match were foundGLOB_NOESCAPE - Backslashes do not quote metacharactersGLOB_BRACE - Expands {p, q, r} to match 'p', 'q', or 'r'GLOB_ONLYDIR - Return only directories which match the ... Read More

Using HTML5 Server-Sent Events in a web application

Jennifer Nicholas
Updated on 20-Dec-2019 10:49:19

244 Views

To use Server-Sent Events in a web application, you would need to add an element to the document.The src attribute of the element should point to an URL that should provide a persistent HTTP connection that sends a data stream containing the events.The URL would point to a PHP, PERL or any Python script that would take care of sending event data consistently.ExampleHere is an example showing application that would expect server time.                    /* Define event handling logic here */                                                              

PHP timestamp to HTML5 input type=datetime element

karthikeya Boyini
Updated on 20-Dec-2019 10:47:47

916 Views

For HTML5 input time, in PHP:Exampleecho date("Y-m-d\TH:i:s");OutputThe output would be:2018-28-03T19:12:49HTML with Timestamp would be:

Advertisements