How does one check that the data in an array is three consecutive digits? (Give me some comments ..) how to check that the data in the array is three consecutive digits? ------ Solution -------------------- PHPcode $ arrarray (,); $ counter1; for ($ i0; $ I & lt; count ($ arr) -1; $ I ++) how does one check that the data in the array is three consecutive digits? (Give me some comments ..)
How does one check that the data in an array is three consecutive digits?
------ Solution --------------------
PHP code
$ Arr = array (,); $ counter = 1; for ($ I = 0; $ I <count ($ arr) -1; $ I ++) {if ($ arr [$ I + 1] ==$ arr [$ I] + 1) {$ counter ++; if ($ counter = 3) {echo"Find the number of the continuous value: \ n [". ($ I-1 ). "] =>{$ arr [$ I-1]} \ n [". $ I. "] =>{$ arr [$ I]} \ n [". ($ I + 1 ). "] =>{$ arr [$ I + 1]} \ n
";}} Else $ counter = 1 ;}