Search
 
SCRIPT & CODE EXAMPLE
 

PHP

find the highest number from array in php

// this code is from PRogrammerRimon, Email: nwscience98@gmail.com; date: 25-04-2022
$numbers = [1, 3,44,5,66,78,33];
$max = 0;
    foreach ($numbers as $v) {
         if($max < $v) {
             $max = $v;
         }
    }
    echo $max;
Comment

find largest element of an array in php

<?php 
$array = array(5,7,81,0,12);

$max1 =0 ;
$max2 = 0;

for($i=0; $i $max1)
    {
      $max2 = $max1;
      $max1 = $array[$i];
    }
    else if($array[$i] > $max2)
    {
      $max2 = $array[$i];
    }
}
echo "Maximum value = ".$max1;
echo "
"; 
echo "Second maximum Value =".$max2;
?> 
Comment

PREVIOUS NEXT
Code Example
Php :: laravel file permission denied 
Php :: array_shift in php 
Php :: push element in array php 
Php :: php mysql row to json 
Php :: yii framework 
Php :: laravel array update 
Php :: ERROR: Module mpm_event is enabled - cannot proceed due to conflicts. It needs to be disabled first! Considering conflict mpm_worker for mpm_prefork: ERROR: Could not enable dependency mpm_prefork for php7.2, aborting 
Php :: simple php round example 
Php :: Laravel 9 Route problem return 404 NOT FOUND 
Php :: laravel get only validated data 
Php :: php cheat sheet 
Php :: how to refresh migration in laravel without losing data 
Php :: return true false laravel 
Php :: phpunit check exception not thrown 
Php :: change php version 
Java :: javafx center node in gridpane 
Java :: java list string package import 
Java :: how to clear terminal in java 
Java :: how to check if recyclerview is empty 
Java :: android studio lower case letters on a button 
Java :: how to circular a bitmap android 
Java :: how to print to console in java 
Java :: Could not find any matches for com.transistorsoft:tsbackgroundfetch:+ as no versions of com.transistorsoft:tsbackgroundfetch are available. 
Java :: listview get selected java 
Java :: java choose random enum 
Java :: set color of text for jlabel 
Java :: javafx button with icon 
Java :: edittext hint color 
Java :: dialog with edittext android 
Java :: java double to fixed decimal 
ADD CONTENT
Topic
Content
Source link
Name
7+2 =