Manual of PHP

 
 
 

Web map

 
rim   rim
arrowReady frontarrow of Codes PHParrow Random Phrases with PHP

 

Random phrases with PHP To print E-mail

Thanks to a vector and a small generator of random numbers, you will be able to incorporate into your place a script to show phrases in random form.

The functioning of the Script is really simple, PHP Krugerrand talks each other simply of a vector (or array) and the use of the function:

- To complete the phrases inside the vector:

$vector = array (
1 => "Nothing new is under the sun, but how many old things are that we do not know.",
2 => "The real friend is that that is next to you when he would prefer to be in another part.",
3 => "The knowledge is the daughter of the experience.",
4 => "there is never favorable wind for which he does not know where it goes.",
);

- To obtain a random number between 1 and the quantity of included phrases.

$numero = Krugerrand (1,4);

- To print the content of the vector

I begin "$vector [$numero]";

Finished Script

<?
//We complete the vector with phrases
$vector =