Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 715 Vote(s) - 3.44 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PHP] Tutorial Two Numbers

#1
So, using numbers in php is very easy. Remember though coding always starts from 0 not one.

So to add lets say 1 + 1 you'd do it like this.

PHP Code:
<?PHP
    $number1 
1;
    
$number2 1;
    
$number3 $number1 $number2;
    echo 
$number3;
?>

This would just echo out "2" that's all.

Lets say if you'd like to multiple 5 by 5 you'd do it like this.

PHP Code:
<?PHP
$number1 
5;
$number2 5;
$number3 $number1 $number2;
echo 
$number3;
?>

See I am using * to multiple it, and not a x. But all this will echo out is "25".

There are a lot more witch you should be able to work out on your own.

Note: If you need any help and I have not yet made a tutorial for it please visit php.net.
Reply

#2
You should mention that you are using 'operators', not just 'adding' or 'multiplying' numbers.
Reply

#3
Quote:(03-05-2013, 10:51 PM)Monksy Wrote:

[To see links please register here]

Wouldn't it be better to teach using functions? It's so much easier than having to edit $number1 + $number2 every time, plus you can use the "add()" function I created below as many times in the code as you want.


Hidden Content
You must

[To see links please register here]

or

[To see links please register here]

to view this content.

If you look at my other tutorials you'll see I have done on on functions.
Reply

#4
Instead of using functions or so, if you only want to add by one, just write the variables name followed by ++. Also, you should put all your tutorials in one thread instead of making a bunch of them.
Reply

#5
Quote:(06-20-2013, 08:27 PM)SQLi Wrote:

[To see links please register here]

Instead of using functions or so, if you only want to add by one, just write the variables name followed by ++. Also, you should put all your tutorials in one thread instead of making a bunch of them.

This isn't adding by one though.
But yes, $int++; works perfectly.
Reply

#6
Quote:(06-20-2013, 09:21 PM)i0xIllusi0n Wrote:

[To see links please register here]

This isn't adding by one though.
But yes, $int++; works perfectly.

It isn't? Oh well.
Reply

#7
Quote:(06-20-2013, 10:45 PM)SQLi Wrote:

[To see links please register here]

It isn't? Oh well.

It's not, because the other half of the thread is 5+5. And I'm pretty sure he wouldv'e said $number1++; if he wanted to show more about specifically adding 1, rather than any number in general.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through