Jump to content

simple code inversion


calmchess

Recommended Posts

I need to invert this code so it does eveything  oppisite .....could  you pleas help me... i can't seem to wrap my mind around it :(

$counter = 2;
$totUsers0 = $counter0 - 4;
$refNum0 = $counter0 / 4;
$refNum1 = floor($refNum0);
$totU = $totUsers0 + 1;
$xCounter = $counter0+=1;

Link to comment
Share on other sites

You may want to explain what this code is supposed to do because as there are a few mistakes in your code:

 

$counter0 does not exist also after you code has run your variables contain:

 

$counter = 2;

$totUsers0 = -2;

$refNum0 = .5;

$refNum1 = 0;

$totU = -1;

$xCounter = 3;

 

So what should be the opposite?

 

$counter = -2;

$totUsers0 = 2;

$refNum0 = -.5;

$refNum1 = 0;

$totU = 1;

$xCounter = -3;

Link to comment
Share on other sites

what do you mean by opposite? as in reverse the order?

$xCounter = $counter0+=1;
$totU = $totUsers0 + 1;
$refNum1 = floor($refNum0);
$refNum0 = $counter0 / 4;
$totUsers0 = $counter0 - 4;
$counter = 2;

but that doesn't really make sense (and will produce notices) Can you explain a little better what you want? Also explaining what this code does would help too

Link to comment
Share on other sites

i'm  sorry what it does is it gets the current count of user that executes out of the database  then it divides the current number of  people by 4 so that i get 4 refrence numbers like ....1111....2222....3333  i need to take the refrence number and go in reverse to get what the current count would be if this were the current refrence number.....there a small amount of database stuff that i didn't include I just use some sudo data to accomplish it.....thanks for your time.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.