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 :: increase memory limit wordpress 
Php :: fetch value from json link in php 
Php :: how to change date formate in php 
Php :: install laravel 
Php :: php split array in half 
Php :: php replace blackslash 
Php :: php get tempfile 
Php :: blade if 
Php :: excel extract date from dd mm yyyy laravel blade 
Php :: pre function for PHP 
Php :: foreach loop laravel 
Php :: updating-product stock quantity programmatically woocommerce 
Php :: php date from format 
Php :: php replace all spaces with dashes 
Php :: validation error message in laravel 
Php :: migrate specific file laravel 
Php :: php last day of month 
Php :: get blog page url in wordpress 
Php :: php curl_exec get response json 
Php :: laravel asset 
Php :: laravel run migration specific file 
Php :: php foreach random 
Php :: break and continue in laravel 
Php :: order by in datatable laravel 
Php :: get last month using php 
Php :: laravel 8 route 
Php :: store emoji in php 
Php :: laravel curl package 
Php :: get featured image id wordpress 
Php :: laravel log build 
ADD CONTENT
Topic
Content
Source link
Name
4+2 =