### Learn How to create a Numerology Calculator in PHP!

Before going to the programming Language. You have to take a look at the below site for knowing numerology values.

Chaldean Numerology Explanation

The script I’m going to write here is based on Chaldean Numerology.

First create an Array of values based on the Numerology Equivalent to the Alphabets.

```
\$ar = array(
'A' => 1,
'B' => 2,
'C' => 3,
'D' => 4,
'E' => 5,
'F' => 8,
'G' => 3,
'H' => 5,
'I' => 1,
'J' => 1,
'K' => 2,
'L' => 3,
'M' => 4,
'N' => 5,
'O' => 7,
'P' => 8,
'Q' => 1,
'R' => 2,
'S' => 3,
'T' => 4,
'U' => 6,
'V' => 6,
'W' => 6,
'X' => 5,
'Y' => 1,
'Z' => 7);

```

So each Alphabets now holds the determined value based on Chaldean Numerology.

Now create an HTML Form and get the text entered by POST method.

```
//get the value entered by post method
\$str = \$_POST['str'];
//make it upper case. to avoid messing with small letters.
\$str = strtoupper(\$str);
//find the length of the string entered
\$len = strlen(\$str);

//set a temp value to calculate
\$numero = 0;

//now loop through the string one by one and add the values
for(\$i=0; \$i<\$len; \$i++)
{
\$alpha  = \$str[\$i];
\$numero = \$ar[\$alpha] + \$numero;
}

```

For loops is used to loop through all the equivalent value for the particular Alphabet and to add them respectively.

For your convenience i have give the whole code here.

```
<?php
error_reporting(0);

if(\$_POST)

{
// create an array based on chaldean numerology

\$ar = array('A' => 1,
'B' => 2,
'C' => 3,
'D' => 4,
'E' => 5,
'F' => 8,
'G' => 3,
'H' => 5,
'I' => 1,
'J' => 1,
'K' => 2,
'L' => 3,
'M' => 4,
'N' => 5,
'O' => 7,
'P' => 8,
'Q' => 1,
'R' => 2,
'S' => 3,
'T' => 4,
'U' => 6,
'V' => 6,
'W' => 6,
'X' => 5,
'Y' => 1,
'Z' => 7);

//get the value entered by post method
\$str = \$_POST['str'];
//make it upper case. to avoid messing with small letters.
\$str = strtoupper(\$str);
//find the length of the string entered
\$len = strlen(\$str);

//set a temp value to calculate
\$numero = 0;

//now loop through the string one by one and add the values
for(\$i=0; \$i<\$len; \$i++)
{
\$alpha  = \$str[\$i];
\$numero = \$ar[\$alpha] + \$numero;
}
//print the result
echo "NUMEROLOGY TOTAL IS: ". \$numero;
}

?>

<html>
<body>
<form action="" method="post">
<input type="text" name="str"  value="" />
<input type="submit" value="calculate" />
</form>

```

You can also see the demo in here

## 13 thoughts on “Learn How to create a Numerology Calculator in PHP!”

• Hei,
I need php numerology script in my new website.
I have already name and birtdate calculator. Now i want ass there expressions, personality, personal years, personal month, personal days, etc. calculator.
Can you to this for me, if i pay?
Thank you 🙂

• Sure. I can do that!. I Sent my personal mail to you. Kindly Reply to that.

• I am sorry but where is the code of your “data_class.php” ?
Without this file i can’t run your script it seems 🙁

dg108

• Thanks for noticing it. Actually i wrote that code for one my own project you can see it here http://babynames.agurchand.com
Actually you don’t need “data_class.php” and the next line ‘\$obj = new Data’ for this script.

Anyhow, I edited the script. You can try now! 😉

• Thanks a lot ! You are right, your script is running fine with no need of the data_class.php file.
Best Regards
dg108

• Hello! I need help to put a name and birthday numerology calculator on my website. Could you help me for some financial compensation? Thanks!

• Is there anyway to display the result below the input box and not above

• Almost a great script. The problem is that numerology requires a single numerical digit. Your script does not reduce values with more than one digit to a single digit, and is therefore useless for numerological purposes. It’s a good starting point though, so thank you.

• Line number edit like this.,
echo “NUMEROLOGY TOTAL IS: “. \$numero%9;
then It works.

• how to calculate numberology based on date and name

• For X value was wrong., Its 5 not 7.,
Some website using A-Z 1-9 method., which one is correct

• There are two different numerology systems. One is chaldean and the other one is Pythagorean. Chaldean is Indian numerology system, where as the A-Z 1-9 method is Pythagorean. I have corrected the X value.

• Thanks for the quick reply and Fix.,