Surnia Ulula
  •  Social + Search Optimization
  •  Premium Support

hours

PHP – Create an Array of Hours

April 15, 2016Updated on November 27, 2025 JS Morisset PHP

If you need to create an array of store hours (for example), the following function can generate an associative array of values quickly, with the hours formatted and stepped (every hour, 30 mins, etc.) as you wish.

I’ve seen similar functions using DateTime(), but we’re already working with timestamps, so there’s really no need.

Continue reading


WordPress Plugin News

Free Wordpress Plugins

  • JSM's Accurate Modified Time for SEO
  • JSM's Adobe XMP / IPTC for WordPress
  • JSM's Decolorize Menu Icons
  • JSM's file_get_contents() Shortcode
  • JSM's Force HTTP to HTTPS
  • JSM's Inherit Parent Featured Image
  • JSM's Non-Breaking Space for French Content
  • JSM's Pretty Schema JSON-LD
  • JSM's Screenshot Machine Shortcode
  • JSM's Simple User Locale Selector
  • JSM’s Show Comment Metadata
  • JSM’s Show Post Metadata
  • JSM’s Show Registered Shortcodes
  • JSM’s Show Term Metadata
  • JSM’s Show User Meta
  • WPSSO Commerce Manager Catalog Feed XML
  • WPSSO Google Merchant Feed XML
  • WPSSO Ratings and Reviews
  • WPSSO REST API
  • WPSSO Schema Breadcrumbs Markup
  • WPSSO Schema FAQ Page Manager
  • WPSSO Schema Merchant Return Policy Manager
  • WPSSO Schema Organization and Place Manager
  • WPSSO Schema Product Metadata for WooCommerce
  • WPSSO Schema Shipping Delivery Time for WooCommerce
  • WPSSO Schema Shortcode
  • WPSSO Strip Schema Microdata
  • WPSSO Tune WP Image Editors
  • WPSSO Update Manager
  • WPSSO User Locale Selector
  • WPSSO WP Sitemaps XML with News, Image, and Video Sitemap

Premium WordPress Plugins

  • WPSSO Core Premium

Popular Tags

add-on answers bind command content debug delete developer documentation error facebook faq faqpage google howto image install integration ld+json mirror notes puppet questions redirect remove schema.org setup shortcode ssh theme thumbnail toolbar uninstall videos woocommerce wordpress wpsso wpsso-am wpsso-bc wpsso-faq wpsso-rar wpsso-rest wpsso-tie wpsso-wc-metadata xml

Post Categories