Generate a random title from an array

give this an array of strings and it will pick a random one to return from the array.

PHP

/* Generate a random Page Title */
$pt_array = [
  "Title One",
  "Title Two",
];
echo $random_title = $pt_array[ array_rand($pt_array,1) ];

Other Items in php
Related Search Terms
Page Views

This page has been viewed 378 times.

Search Code
Search Code by entering your search text above.
Welcome

This is my test area for webdev. I keep a collection of code snippits here, mostly for my reference. Also if i find a good site, i usually add it here.

âĪðŸ‘Đ‍ðŸ’ŧðŸ•đ

Random Quote
Ever tried. Ever failed. No matter. Try again. Fail again. Fail better. You won't believe what you can accomplish by attempting the impossible with the courage to repeatedly fail better.
Unknown