Created
April 14, 2020 15:04
-
-
Save taciara/ec13a800f6db13c686dbf70f19548bb9 to your computer and use it in GitHub Desktop.
Texto Randômico. Exemplo simples em php, mas que pode ser aplicado em qualquer situação
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>Texto Randômico</title> | |
| </head> | |
| <body> | |
| <?php | |
| $linkArray = ['link', 'link2', 'link3']; | |
| $textoArray = ['texto 1', 'texto 2', 'texto 3']; | |
| $link = rand( 0, count( $linkArray ) - 1 ); | |
| $texto = rand( 0, count( $textoArray ) - 1 ); | |
| ?> | |
| <h1>Texto Randômico:</h1> | |
| <br><br> | |
| <a href="<?php echo $linkArray[ $link ]; ?>"> | |
| <?php echo $textoArray[ $texto ]; ?> | |
| </a> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment