Jump to content
¯\_( ツ)_/¯
  • TAD GROUP are currently hiring penetration testers. Please read the topic in Career Central subforum.
  • Sponsored Ad

Трябвами Php или javascript код.

Recommended Posts


нужна ми е малко помощ свъзана със автоматично калкулиране на едно число.

Идеята е следната - когато напиша произволно число то да се дели автоматично с  проценти на 4 други числа, пример:


10% - 100

25% - 250

50% - 500

15% - 150

търсих доста информация във гугал но не намери това което търся.

ще съм ви много благодарен ако успеете да ми помогнете.

и се извинявам ако темате не е за тук. 

Share this post

Link to post
Share on other sites

$result = [];
$percentages = [.1, .25, .5, .15];

$randomNumber = rand(1, 999999); // 1000

foreach ($percentages as $percentage) {
	$result[] = $randomNumber * $percentage;


  • Like 1

Share this post

Link to post
Share on other sites

Join the conversation

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

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...

Important Information

By using this site, you agree to our Terms of Use. 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.