• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Home
  • Blog
  • Sample Page

WordPress Tips

Just another WordPress site

Output a random string on each page load in PHP

June 30, 2016 Leave a Comment

WP Beaches ~

To output a random string from an array on each page load you can use the array_rand function in PHP.

View this code snippet on GitHub.

So in the above snippet the array is created and assigned to the $input variable, it is then output using echo and passing the $input variable initially to array_rand and the result

Filed Under: array, array_rand, PHP, random Tagged With: array, array_rand, PHP, random

Reader Interactions

Related Posts

  • Create An ACF Repeater Bootstrap Accordion in WordPress
  • Create A Bootstrap 4 Carousel Slider With ACF Image Repeater
  • Create An ACF Repeater Accordion in WordPress
  • Create A Responsive Bootstrap 4 Tab/Accordion ACF Repeater Loop

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Copyright ©2019 · WPress.Tips - All Rights Are Reserved · Powered by Genesis Framework