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 4110604
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T21:57:21+00:00 2026-05-20T21:57:21+00:00

UPDATE Sorry. I wasn’t as clear as I need to be I think. I

  • 0

UPDATE
Sorry. I wasn’t as clear as I need to be I think. I am basically trying to insert more than a text string. The function is in wordpress and pulls in html code from the dashboard for ads.

   <ul id="randomOrderList">
        <li><?php if (function_exists('dfrads')) { echo dfrads('1'); } ?></li>
        <li><?php if (function_exists('dfrads')) { echo dfrads('2'); } ?></li>
        <li><?php if (function_exists('dfrads')) { echo dfrads('3'); } ?></li>
    </ul>

To this:

<ul id="randomOrderList">
    <li><a href="" title=""><img  src="name" alt=" " /></a></li>
    <li><a href="" title=""><img  src="name" alt=" " /></a></li>
    <li><a href="" title=""><img  src="name" alt=" " /></a></li>
</ul>

I tried this but I am not sure how to add the php in the array:

<?
  $array=array('<?php if (function_exists('dfrads')) { echo dfrads('1'); } ?>','<?php if (function_exists('dfrads')) { echo dfrads('2'); } ?>','<?php if (function_exists('dfrads')) { echo dfrads('3'); } ?>');
  shuffle($array);
  $array = array_chunk($array, 5);
  foreach($array as $section){
    echo '<ul id="randomOrderList">'."\n";
    foreach($section as $link){
      echo ' <li>'.$link.'</li>'."\n";
    }
    echo '</ul>'."\n";
  }
?>
  • 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-05-20T21:57:22+00:00Added an answer on May 20, 2026 at 9:57 pm

    You could put your strings into an array :

    $strings = array(
        'something 1', 
        'something 2', 
        'something 3', 
    );
    

    Without any kind of code — which is not permitted in there.

    Then, use the shuffle() function to randomize the array :

    shuffle($strings);
    

    And, now, loop over your array, to display the items :

    echo '<ul id="randomOrderList">';
    foreach ($strings as $string) {
        echo '<li>' . $string . '</li>';
    }
    echo '</ul>';
    

    They will be displayed in random order.

    Edit after edit of the question : you can construct the array calling your function, of course.

    For example, you can use something like this :

    $strings = array(
        dfrads('1'), 
        dfrads('2'), 
        dfrads('3'), 
    );
    

    If needed, you can include all your code inside a test for the existence of the dfrads function :

    if (function_exists('dfrads')) {
        // Create the array
        // randomize it with shuffle
        // do the loop and the echos
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

UPDATE: I've been playing around with this more, and it seems like tmux's clear-history
Is there any way to do this? Update: Sorry, I should have included more
(Important: See update below.) I'm trying to write a function, import_something , that will
UPDATE: sorry my IE 9 was'nt configured well: it should've been set so that
UPDATE Turns out I'm just tired. There isn't any problem here sorry for wasting
Sorry for the double post, I will update this question if I can't get
update: I mistyped 2 variables...so embarrassing. thanks everyone for the effort! sorry i find
Update: Is there a way to achieve what I'm trying to do in an
UPDATE: Sorry I was wrong with my assumption of the problem. Its due to
I'm not even sure how to describe what I'm trying to do (sorry, newb),

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.