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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T00:04:21+00:00 2026-06-05T00:04:21+00:00

I am trying to create a script that takes a $$variable and adds them

  • 0

I am trying to create a script that takes a $$variable and adds them to each other a number of times (based on another variable) – $total

This script is part of a much larger script that contains a few SQL queries and loops, hence the $$value as opposed to the usual $value

My current (static) script is like so:

$$value = ($$value + $$value + $$value + $$value + $$value);

This will work if I continue to modify the number of + $$value within the brackets but I need it to auto calculate and ammend itself so that it always writes the correct number of + $$value

I have tried using str_repeat() but it only fetches the first value of the $$value variable and then repeats that value (not grabbing the next value and so on). I have also tried creating a loop, which also didn’t work.

I need something that will look at $total and from that number produce something similar to the following:

$$value = ($$value * $total)

The above will multiply the numeric value of the $$value and therefore not return the result I want.

Can anyone help?

Many thanks,

Tom

Pastebin Link to my script: http://pastebin.com/7Qg02hWB (in the pastebin, $$value is $$ob_id and $total is $o_total)

  • 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-06-05T00:04:23+00:00Added an answer on June 5, 2026 at 12:04 am

    Not 100% sure what you mean, but how’s

    $foo = "";
    for ($i = 0; $i < $total; $i++) $foo .= $$value;
    $$value = $foo;
    

    This will loop over $total times and concatenate it. If you’re having problems like it’s adding it as an integer for some reason you could always do a cast like (string) $$value. I know you said you tried a loop but we have no code so it could have been a problem with your code.

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

Sidebar

Related Questions

I'm trying to create a script that takes a .txt file with multiple lines
I am trying to create a script that takes in a string with an
im trying to create a script that opens a file and replace every 'hola'
Im trying to create a script that will post a notification stored in a
I am trying to create a script that finds the closest store/location to a
So I'm trying to create a script that converts Celsius to Fahrenheit. When I
I'm trying to create a GreaseMonkey script that automatically extends the list of alerts
I'm trying to create a Python script that would : Look into the folder
I'm trying to create a shell script that shall convert certain Files according to
I've been trying to create a script for myself that will allow me to

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.