PHP: Find maximum odd number of sequence in an array

This is php program that finds the maximum odd number of sequence in an array. By editing, in case of even number also be found out. Code: [php] <?php $x = array(1,7,4,5,7,5,6,3,4,6,87,53,45,567,45,43,66,56,57,5); $tot = count($x); $y = $res = array(); $y[0] = array(); $k = $j = 0; for($i = 0; $i $val) if($max == count($val)) $k = $key; echo “The number of maximum odd sequesnce: $maxThe numbers are:”; var_dump($y[$k]); ?> [/php] Waiting for any better solutions.

Continue Reading

You may also like

A little trick to store data into mysql database from a large form

Sometimes we feel boring to write mysql insertion query to store data into database from a large form where are too many input fields (such as about 50 fields). We face problem to handle all the fields, sometimes we miss the field name. Here is a small trick to store data from such a large form. In this trick, we have to do same naming of table fields and input fields. For example – [html][/html] Then the field name of the database will be “first_name” Then the php code will be: Suppose, name of the submit button is submit [html][/html] […]

Continue Reading

You may also like

jSlider Plugin for jQuery (for 3 horizontal div)

This is my first jQuery plugin. Not so perfect, but it can be used I think This plugin is very easy to use. Doc: This is a small slider content plugin for three horizontal floated div. By clicking on top menu, the divs switch. 1. Just pass the master div id which is wrapping the three floating div in the parameter field named master. 2. Pass id of the three floated divs’ in label parameter under jid index 3. Pass id of the three links’ in label parameter under links index That’s It! You don’t have to mention floated div […]

Continue Reading

You may also like