3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = array( 0.72, 0.72, 0.72, 0.72, 0.72, 0.72, 0.72, 0.72, 0.72, 0.72, 0.35, 0.20, 0.05, 0.05, 0.20, 0.35, 0.72, 0.72, 0.72, 0.72, 0.72, 0.72, 0.72, 0.72 ); $b = array( 97.29, 67.68, 66.97, 67.57, 67.80, 94.71, 136.23, 146.77, 139.06, 95.39, 58.66, 48.90, 37.07, 61.31, 95.26, 140.80, 228.09, 318.25, 407.95, 413.11, 409.11, 394.49, 300.57, 162.24 ); $sumProduct = 0; for( $i = 0; $i<count($a); $i++ ) { $sumProduct += ($a[$i]*$b[$i]); } echo $sumProduct;
Output for 7.4.0 - 7.4.33, 8.0.1 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.12
2705.1236

preferences:
90.08 ms | 406 KiB | 5 Q