Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Escrito por Rodrigo Nery
- *
- * Class Loop com while em PHP
- *
- * @param int $count
- * @param array $args
- */
- class Loop{
- public static $count = 0;
- public static $args = array('Janeiro','Fevereiro','Março','Abril',
- 'Maio','Junho','Julho','Agosto','Setembro',
- 'Outubro','Novembro','Dezembro');
- public static function getArgs(){
- try{
- if(!is_array(self::$args))throw new Exception('Não é um array!');
- while(self::$count <= 11){
- $listar = self::$count++;
- echo $listar . ' - ' . self::$args[$listar] . '<br>' .PHP_EOL;
- }
- }catch(LoopException $e){
- echo $e->getMessage();
- }
- }
- }
- $obj = new Loop;
- $obj->getArgs();
Add Comment
Please, Sign In to add comment