Write a function to find the second largest element in an array. The function takes an array of integers given a string as an argument and returns the second max value from the input array. If there is no second max return -1.
Expand +Tag: array
How to convert array data into Simple XML file using PHP
Hello Buddy, In this post we’ll get the knowledge about how to convert array data into Simple XML file using php code. Most of times we want to get data as a XML format but we get data into array format.…
Expand +Types of Array
Array is the collection of keys and values. The key can either be an integer or a string. The value can be of any type. This is usually done for single-line arrays, i.e. array(1, 2) is preferred over array(1, 2, ).…
Expand +PHP Array Function
Here is the list of PHP array functions sizeof () :- This function is used to count the items of the array. (count() is also used instead of this). Example:
2 3 4 5 6 7 8 9 10 11 12 |
<?php //Define array $data=array(‘Bugatti’,’Gallardo’,’Audi’,’Nissan’,’ Chevrolet ‘); echo sizeof($data); ?> |
explode () :- This function is used…
Expand +