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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:18:26+00:00 2026-05-22T21:18:26+00:00

I have programmed a script with the goto command but on the server where

  • 0

I have programmed a script with the goto command but on the server where I want to execute the script there is a previous PHP version (<5.3), so I have to change the code. The structure of the code goes like that:

for($i = 0; $i < 30; $i++)  // print 30 articles 
{
    $x = 0;
    // choose a a feed from the db
    // parse it

    a:
    foreach($feed->get_items($x, 1) as $item)
    {
        // create a unique id for the article of the feed

      if($id == $dbid)
      {
          // if this id exists in the db, take the next article of the same feed which is not in the db 
          $x++;
          goto a;
      }
      else
      {
          // print the original article you grabbed
      }

   } // end of foreach
} // end of for

I have tested everything. Do you have any ideas how can I retransform this code without goto in order to be executed properly???

  • 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-22T21:18:27+00:00Added an answer on May 22, 2026 at 9:18 pm

    Without knowing how the ->get_items() call behaves you could use this brute-force method in lieu of the goto-switch:

    for($i = 0; $i < 30; $i++)
    {
        $x = 0;
    
    
        $a = 1;
        while ($a--)
        foreach($feed->get_items($x, 1) as $item)
        {
    
          if($id == $dbid)
          {
              $x++;
              $a=1; break;
          }
          else
          {
          }
    
       } // end of foreach
    } // end of for
    

    The label gets replaced by a while and a self-fulfulling stop condition. And the goto becomes a break and resets the $a stop condition.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have programmed a proxy.php script (listed below), which would fetch an image specified
I have a PHP script that needs to execute programmes that will work on
I have programmed an emulator, but I have some doubts about how to organizate
I have been using oracle database throughout database courses, and I have programmed there
I have never programmed a gadget for Vista or Seven, but I would like
I have created a php script to import rss feed into the database. The
I have tried to use the php script to generate PDF with a simple
I have following code in a python script try: # send the query request
I have programmed a very simple script with jQuery. The idea is to fade
I have a PHP script designed to answer a users question. Currently I use

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.