Werbung

Werbung

Werbung

Archive

Folge uns auf Twitter

Werbung

Jede Menge neue Twitter Follower bekommen. Die Software hat einen kostenlosen Trial Mode, der bis zu 250 Follower bringt.

Willkommen

Willkommen im PHP Archiv Blog! Hier gibts Infos zum Thema PHP Codeschnipsel und Tipps. Bei unserem Projekt phparchiv.de, finden Sie über 5700 Scripte.

Zufallstext

Täglich wechselnde Random Quotes

Diese Funktion zeigt täglich wechselnden Zufallstext an.

function RandomQuoteByInterval($TimeBase, $QuotesArray){

// Make sure it is a integer
$TimeBase = intval($TimeBase);

// How many items are in the array?
$ItemCount = count($QuotesArray);

// By using the modulus operator we get a pseudo
// random index position that is between zero and the
// maximal value (ItemCount)
$RandomIndexPos = ($TimeBase % $ItemCount);

// Now return the random array element
return $QuotesArray[$RandomIndexPos];
}

/*
** --> See the example section below for a
** detailed instruction.
*/
[/php]
Quelle: Jonas John

Täglich wechselnde Zufalls Quotes

Mit der PHP Funktion kann man tägliche, wöchentliche usw. Zufalls Quotes einblenden.

function RandomQuoteByInterval($TimeBase, $QuotesArray){

// Make sure it is a integer
$TimeBase = intval($TimeBase);

// How many items are in the array?
$ItemCount = count($QuotesArray);

// By using the modulus operator we get a pseudo
// random index position that is between zero and the
// maximal value (ItemCount)
$RandomIndexPos = ($TimeBase % $ItemCount);

// Now return the random array element
return $QuotesArray[$RandomIndexPos];
}[/php]

Quelle: jonasjohn.de

Zufallstext und mehr mit PHP anzeigen

Ein kleines Script zur Anzeige von zufälligen Inhalten in Webseiten. Die Inhalte werden in eine Textdatei mit Namen random.dat geschrieben. Jeweils ein Ausgabeblock pro Zeile.

Das kann Google Adsense Werbung, ein Banner, ein Text, was auch immer sein. Wichtig ist es, dass alles in einer Zeile geschrieben wird. Der Zeilenumbruch bestimmt das Ende des Anzeigeblocks. Weiterlesen