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

  • Home
  • SEARCH
  • 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 7694669
In Process

The Archive Base Latest Questions

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

EDIT: This code now works correctly, I only left it in case someone finds

  • 0

EDIT: This code now works correctly, I only left it in case someone finds themselves in my situation. Thanks.

I’m facing a very strange situation with my code. I have the following:

$m = 0; $star = ""; $star2 = "";
while($star == "")
{
   //some stuff
   if(m1 == 0) { break; }           
   $m1 -= 1;
}

For some crazy reason, when I’m debugging this code it runs the while loop only once (even though $star is still equal to "" and then reaches the if and breaks.
I have tried different approaches to no avail. Does anyone know why this is happening?

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

    There’s no $ before m1, so PHP will assume it’s a literal string ‘m1’ and throw a notice error. ‘m1’ is then compared with 0, which is true, and your loop breaks.

    You haven’t initialized $m1 in your example either, so even if you used $m1, it would still break.

    Make sure you have all PHP errors and warnings turned on, they are very helpful for things like this!

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

Sidebar

Related Questions

(EDIT: This question is now outdated for my particular issue, as Google Code supports
Edit: Updated code. Now works well enough. Foreword. I am an OpenGL newb tasked
Edit: This code is fine. I found a logic bug somewhere that doesn't exist
I am getting a StackOverflow Error in this code: EDIT [XmlAttribute(ID)] public string ID
Edit: This was accidentally posted twice. Original: VB.NET Importing Classes I've seen some code
Edit: I put this snippet of code in jsbin: http://jsbin.com/eneru I am trying to
I have this html code that i want to edit with jQuery. Here is
Code as reference: http://jsbin.com/aboca3/2/edit In this example above (thank you SLaks) I am truncating
Edit: Of course my real code doesn't look exactly like this. I tried to
how does one use code to do this: produce 15 random numbers [EDIT: from

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.