- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 1466 Articles for PHP
40 Views
The krsort() method sorts an array by key in reverse order. It returns TRUE on success or FALSE on failure.Syntaxksort(arr, flag)Parametersarr − The array to sort.flag −0 = SORT_REGULAR - Default. Compare items normally. Do not change types.1 = SORT_NUMERIC - Compare items numerically2 = SORT_STRING - Compare items as strings3 = SORT_LOCALE_STRING - Compare items as strings, based on current locale4 = SORT_NATURAL - Compare items as strings using natural ordering.ReturnThe krsort() function returns TRUE on success or FALSE on failure.ExampleThe following is an example − Live DemoOutputThe following is the output −r = mouse q = pendrive p = ... Read More
148 Views
The in_array() function checks if a specified value exists in an array.Syntaxin_array(find, arr, type)Parametersfind − The value to be searchedarr − The array to searchtype − The mode in which the search is to be performed. If the parameter is set to TRUE, then it looks for for the search string and specific type in the array.ReturnThe in_array() function returns TRUE if the value is found in the array, or FALSE otherwise.ExampleThe following is an example − Live DemoOutputThe following is the output −Match!ExampleLet us see another example − Live DemoOutputThe following is the output −Match!Read More
188 Views
The end() function sets the internal pointer of an array to its last elementSyntaxend(arr)Parametersarr − The specified arrayReturnThe end() function returns the value of the last element in the array, on success. It returns FALSE, if the array is empty.ExampleThe following is an example − Live DemoOutputThe following is the output −solarisExampleLet us see another example − Live DemoOutputThe following is the output −one two two six six
110 Views
The current() function returns the current element in an array.Syntaxcurrent(arr)Parametersarr − The specified array. Required.ReturnThe current() function returns the value of the current element in an array.ExampleThe following is an example − Live DemoOutputThe following is the output −oneExampleLet us see another example − Live DemoOutputThe following is the output −one two two
146 Views
The compact() function creates an array containing variables and their values.. It returns an array with all the variables added to itSyntaxcompact(variable1, variable2)Parametersvariable1 − Can be a string with the variable name, or an array of variables. Required.variable2 − Can be a string with the variable name, or an array of variables. Optional.ReturnThe compact() function returns an array with all the variables added to it.ExampleThe following is an example − Live DemoOutputThe following is the output −Array ( [ELE] => Electronics [ACC] => Accessories )ExampleLet us see another example − Live DemoOutputThe following is the output −Array ( [name => Tom [subject] ... Read More
130 Views
The arsort() function sorts an array in reverse order and maintain index association.Syntaxarsort(arr, compare)Parametersarr − The specified array.compare − Specifies how to compare the array elements/items. Possible values −SORT_STRING - Compare items as stringsSORT_REGULAR - Compare items without changing typesSORT_NUMERIC - Compare items numericallySORT_LOCALE_STRING - Compare items as strings, based on current local.SORT_NATURAL - Compare items as strings using natural orderingReturnThe arsort() function returns TRUE on success and FALSE on failure.ExampleThe following is an example − Live DemoOutputThe following is the output −Key=Bangladesh : Value=9 Key=India : Value=5 Key=Australia : Value=2Read More
104 Views
The array_walk() method applies a user-defined function to every member of an array. It returns TRUE on success and FALSE on failure.Syntaxarray_walk(arr, custom_func, parameter)Parametersarr − The specified array. Required.custom_func − The user defined function. Required.parameter − The parameter to be set for the custom function. Optional.ReturnThe array_walk() function returns TRUE on success and FALSE on failure.ExampleThe following is an example − Live DemoOutputThe following is the output −p id : Student Tom q id : Student Jack r id : Student Amit
75 Views
The array_unshift() function adds one or more elements to the beginning of an array.Syntaxarray_unshift(arr, val1, val2, val3)Parametersarr − The specified array. Required.val1 − Value to be inserted. Required.val2 − Value to be inserted. Optional.val3 − Value to be inserted. Optional.ReturnThe array_unshift() function returns the new elements in the array.ExampleThe following is an example − Live DemoOutputThe following is the output −3ExampleLet us see another example − Live DemoOutputThe following is the output −Array ( [0] => three [p] => one [q] => two )
19 Views
The array_uintersect_unassoc() function compares array keys and array values in user-made functions, and returns an arraySyntaxarray_uintersect_uassoc(arr1, arr2, arr3, … , compare_func1, compare_func2)Parametersarr1 − The first array to compare from.arr2 − The second array to be compared with.arr3 − More arrays to compare.compare_func1 − The comparison function that compares the array keys. 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.compare_func2 − The comparison function that compares the array values. It must return an integer less than, equal to, ... Read More
50 Views
The array_uintersect() function compares array values in a user-made function and returns an array. It returns an array containing all the values of the first array that are not present in any of the other parameters.Syntaxarray_uintersect(arr1, arr2, arr3, … , compare_func)Parametersarr1 − The first array to compare from.arr2 − The second array to be compared with.arr3 − More arrays to compare.compare_func − 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 array_uintersect() function returns an ... Read More
To Continue Learning Please Login
Login with Google