jonhyhvaftn Posted February 11, 2016 at 04:58 PM Report Share #593366 Posted February 11, 2016 at 04:58 PM (edited) Bem, deu-me uma branca daquelas complicadas... Basicamente quero fazer um ciclo for regressivo, em que comece no numero 2016 e termine no 2005. Ao tentar fazer não consegui e fui pesquisar na net. Depois de alguns minutos nada achei, parece que só fazem progressivos e nunca regressivos. Tentei a seguinte maneira, parecia-me a mais óbvia: $current = date("Y"); for ($i = $current; $i < 2005; $i--) { echo $i; } Alguém me pode ajudar? Edited February 11, 2016 at 05:23 PM by pwseo indent. Link to comment Share on other sites More sharing options...
Solution pwseo Posted February 11, 2016 at 05:22 PM Solution Report Share #593369 Posted February 11, 2016 at 05:22 PM jonhyhvaftn, Repara bem no que escreveste: for ($i = $current; $i < 2005; $i--) O que tu queres é um ciclo que execute enquanto $i >= 2005, caso contrário não funciona. 1 Report Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now