Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8686799
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:57:23+00:00 2026-06-12T22:57:23+00:00

Since I’m not much of a php guy I need help with creating an

  • 0

Since I’m not much of a php guy I need help with creating an array that holds YouTube videos and a description for each video.

Right now I have an array that only holds the video id’s. What is the best way to add a Description to each ID so I can easily loop through the array and create the desired output underneath.

<?php
    $vids = array(
        "OOWvNbU6ciLg",
        "5itTJabAJfps",
        "jFA8Tesmames",
        "Trz9Y01xx1TY",
        "mMQGcIrlyseU",
        "qGrlQNvqqL14",
        "QymnLbSpJ7lA",
        "jFAh8Tesmmes",
        "5itTJtbAJfps",
        "OOWvNpU6ciLg"
    );
?>

What I want eventually is a list of videos with a video description underneath. And I want my array to be shuffled before the list is created so I have a different order each time the list is created.

HTML

<li class="video">
    <figure>
        <iframe width="100%" height="200px" src="http://www.youtube.com/embed/OxXAT2epfEYA?HD=1;rel=0;showinfo=0" frameborder="0" allowfullscreen></iframe>
        <figcaption>Description of the video</figcaption>
    </figugre>
</li>

What would be the best way to define the array so I can shuffle it and then loop through the array and print each <li> item with the iframe embed code and the description underneath.

Thank you in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T22:57:24+00:00Added an answer on June 12, 2026 at 10:57 pm

    Keep all info about video in associative array:

    $single_video = array(
        "id" => "OOWvNbU6ciLg",
        "description" => "Video descr"
    );
    

    Now build an array of these videos:

    $vids = array(
        array(
            "id" => "OOWvNbU6ciLg",
            "description" => "Video descr"
        ),
        array(
            "id" => "5itTJabAJfps",
            "description" => "Other video descr"
        ),
    );
    

    Now you can shuffle it easily, and loop:

    $vids = array();
    shuffle($vids);
    foreach($vids as $video){
        //$video here is associative array with single video
        echo "{$video['id']} - {$video['description']}";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Since no other topics uses the script I use, I need serious help. I
Since EF doesn't support unique key contraints, it seems that we need to catch
Since regular jQuery animations are not fluent on iOS ( .hide() , slideDown() ),
Since REST is stateless, each request that comes in has no knowledge of the
Since Intellij does not yet support the Play-Scala-Template-Engine I was thinking about using plain
Since hist() of the base R does not report percentages (and the freq=FALSE) does
Since i'm not strong in asp.net, probably my question will sound silly. I've got
Since yesterday suddenly my Eclipse does not work anymore. The error is Failed to
Since I embeded fetch request in my model.xcdatamodeld, I need an instance of NSManagedObjectModel
Since in the control file I have to provide a name (hard-coded) I need

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.