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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:21:22+00:00 2026-05-25T23:21:22+00:00

Firstly poor of my mathematica. I tried to use php to make a number

  • 0

Firstly poor of my mathematica. I tried to use php to make a number to Multiples of 7. the rules as below:

$num >=0;

$num = '0'; => output '7'    
$num = '1'; => output '7'
$num = '6'; => output '7'
$num = '8'; => output '14'
$num = '14'; => output '14'
$num = '16'; => output '21'
$num = '20'; => output '21'
$num = '40'; => output '42'
$num = '84'; => output '84'
...

I cost many times, but I am not smart to solve this by myself. such as

 echo round(($num*7-1)/7); // not a right answer.

any one is kindly help me? Thanks.

  • 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-25T23:21:22+00:00Added an answer on May 25, 2026 at 11:21 pm

    Your requirements are not consistent if the output for 0 is 7; 0 is already a multiple of 7, since 0 * 7 = 0.

    echo ceil($num / 7) * 7;
    

    Alternatively, use the modulus operator:

    $m = $num % 7;
    echo $m == 0 ? $num : $num - $m + 7;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

everyone. Firstly, forgive my poor English #_# I use ubuntu 11.10 now. And I
Firstly some background,.. IVe started a new job as PHP developer with a company
Firstly, apologies for all the XAML. I've tried for a few days to resolve
Firstly is it possible to use objective C to find out if the user's
Firstly, apologies if I make a lot of mistakes in best VBA practice. I've
Firstly, the example: http://jsfiddle.net/Koviko/92PZZ/ Here, I use jQuery UI's draggable plugin to allow a
Firstly, I am an absolute beginner in programming, so don't make fun of me
Firstly, I do not have the option to use Regular Expressions. It pains me
Firstly I am assuming DependencyProperty is what to use but I could be wrong
Firstly, Real World Haskell , which I am reading, says to never use foldl

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.