Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

TutsPlus.com:
Trigonometry, Random Numbers and More With Built-in PHP Math Functions
Oct 16, 2018 @ 16:56:01

The TutsPlus.com site has another great PHP tutorial for those new to the language covering mathematical functionality in the language, from the basics out to more complex topics like trigonometry and random number generation.

Basic maths is used a lot during programming. We need to frequently compare, add, multiply, subtract and divide different values when writing code.

Sometimes, the maths required in a program can be more involved. You might need to work with logarithmic, trigonometric or exponential functions. In this tutorial, I'll discuss how to use each of these functions in PHP, with examples.

This tutorial will introduce you to the built-in math functions in PHP for doing trigonometry, exponentiation, and logarithm calculations. We'll also look at rounding and generating random numbers.

They start off with some of the "heavy hitters" in PHP's math functionality and how how to perform trigonometric operations with the likes of sin, cos and tan. This is applied to create an interesting dynamic image using the GD functionality. Next up comes the exponential and logarithmic functions with simple examples followed by a section sharing some other useful math functions for more everyday needs.

tagged: tutorial math trigonometry random number introduction

Link: https://code.tutsplus.com/tutorials/mathematical-functions-in-php--cms-31972

PHPBuilder.com:
Math & Number Handling in PHP - The ABCs of PHP Part 6
Apr 22, 2009 @ 12:57:17

On PHPBuilder.com today they've posted the next article in their "ABCs of PHP" series. This time they focus on math and number handling.

Last time we looked at text and strings in variables, in this episode we're going to continue with our exploration of PHP variables and delve deeper into math and number handling in PHP. Using numbers is not much different to using text and strings, you allocate variables and fill them in, using exactly the same techniques as you do using strings & text.

They covers some of the basic operators (+,-,*,etc), evaluation with equals, number shifting, binary and creating a "barrel shifter" to work with the binary bits of a number.

tagged: shifter barrel binary introduction abc handling number math

Link:

Sara Golemon's Blog:
Fun with unicode
Jul 30, 2007 @ 13:45:00

Sara Golemon, being interested in Unicode as she is, decided to investigate further when she saw a recent post about issues with Unicode math symbols:

Being a whimsical sort, I decided that actually implementing his request would be more fun than simply pish-poshing it. I'm not suggesting this be part of PHP6 (I still don't personally think it's a good idea), but it's a fun exercise and good for a conversation starter...

There's several things she can now do with the special characters including dumping out the results of divisions, comparisons and fractions natively.

tagged: unicode vardump math symbols programming patch php6 unicode vardump math symbols programming patch php6

Link:

Sara Golemon's Blog:
Fun with unicode
Jul 30, 2007 @ 13:45:00

Sara Golemon, being interested in Unicode as she is, decided to investigate further when she saw a recent post about issues with Unicode math symbols:

Being a whimsical sort, I decided that actually implementing his request would be more fun than simply pish-poshing it. I'm not suggesting this be part of PHP6 (I still don't personally think it's a good idea), but it's a fun exercise and good for a conversation starter...

There's several things she can now do with the special characters including dumping out the results of divisions, comparisons and fractions natively.

tagged: unicode vardump math symbols programming patch php6 unicode vardump math symbols programming patch php6

Link:

Paul Jones' Blog:
TypeKey and Big-Number Math: Yay Wez!
Feb 21, 2007 @ 14:26:00

Paul Jones is rejoicing a bit about the OpenID and Typekey functionality Wez Furlong shared just the other day on his blog.

Wez Furlong gives us good news about implementing the math functions needed to support TypeKey and OpenID more directly within PHP.

Paul also mentions that the Solar framework has also had the Typekey support integrated for a while now (as an adapter) that uses the "big-number math functions" currently available to PHP developers. Wez's solution, however, would just about make those obsolete.

tagged: bignumber math openid typekey adapter solarframework bignumber math openid typekey adapter solarframework

Link:

Paul Jones' Blog:
TypeKey and Big-Number Math: Yay Wez!
Feb 21, 2007 @ 14:26:00

Paul Jones is rejoicing a bit about the OpenID and Typekey functionality Wez Furlong shared just the other day on his blog.

Wez Furlong gives us good news about implementing the math functions needed to support TypeKey and OpenID more directly within PHP.

Paul also mentions that the Solar framework has also had the Typekey support integrated for a while now (as an adapter) that uses the "big-number math functions" currently available to PHP developers. Wez's solution, however, would just about make those obsolete.

tagged: bignumber math openid typekey adapter solarframework bignumber math openid typekey adapter solarframework

Link:

Zend Developer Zone:
PHP Gotchas!
Apr 24, 2006 @ 17:49:58

The Zend Developer Zone has a new post for those out there struggling with the small stuff. You've got the language down and you're learning the syntax, but there's still a few things that elude your grasp. If this is you, check out their list of "PHP Gotchas" to see if your problem is on there.

Call them obscure, call them pointless, call them "newb mistakes." Whatever you call them, you've more than likely been tripped up at some point in your PHP coding journey by seemingly odd or illogical behaviors of the language. With PHP being a loosely-typed language, funny things are bound to happen.

PHP is an easy language to pick up for the casual coder--things should "just work." But not everyone comes into PHP development with a strong programming background, so here are some charming examples of ways PHP can trip you up if you aren't careful. Put on your thinking caps--here comes the science!

Included in their list of common problems for budding PHP developers are things like finding a "needle" in a string "haystack", working with constants, using and/or, and the __toString functionality in PHP5.

tagged: gotchas strings constants tostring logic math gotchas strings constants tostring logic math

Link:

Zend Developer Zone:
PHP Gotchas!
Apr 24, 2006 @ 17:49:58

The Zend Developer Zone has a new post for those out there struggling with the small stuff. You've got the language down and you're learning the syntax, but there's still a few things that elude your grasp. If this is you, check out their list of "PHP Gotchas" to see if your problem is on there.

Call them obscure, call them pointless, call them "newb mistakes." Whatever you call them, you've more than likely been tripped up at some point in your PHP coding journey by seemingly odd or illogical behaviors of the language. With PHP being a loosely-typed language, funny things are bound to happen.

PHP is an easy language to pick up for the casual coder--things should "just work." But not everyone comes into PHP development with a strong programming background, so here are some charming examples of ways PHP can trip you up if you aren't careful. Put on your thinking caps--here comes the science!

Included in their list of common problems for budding PHP developers are things like finding a "needle" in a string "haystack", working with constants, using and/or, and the __toString functionality in PHP5.

tagged: gotchas strings constants tostring logic math gotchas strings constants tostring logic math

Link:


Trending Topics: