Last active
August 29, 2015 14:01
-
-
Save giovannipds/6dbc11ac46d0819d60c7 to your computer and use it in GitHub Desktop.
Links separados vírgula e "e" em PHP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php $length = 6; // apenas para exemplo ?> | |
<?php for ($i = 0; $i < $length; $i++) { ?> | |
<a>Elemento</a><?php if ($i + 1 !== $length && $i + 2 !== $length) { ?>,<?php } else if ($i + 2 === $length) { ?> e <?php } else if ($i + 1 === $length) { ?>.<?php } ?> | |
<?php } ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment