|  | From Scott Orgera, your About Programming Editor This week we learn how to make a pregnancy calculator in PHP for those folks either expecting a new arrival or just wanting to learn how to create a really cool counter program. We also delve into the database concept of referential integrity, explain how to create functions and subroutines in Linux Bash scripts, discuss the Require method in Ruby, and much more... | | Functions and Subroutines in Bash Scripts Even though Bash is a Linux shell, it has many of the capabilities needed to be a general purpose programming language, such as loops and conditional expressions. While-loops and For-loops are ways to execute a sequence of instructions multiple times. Functions are another method you can use to prevent code duplication. | PHP Pregnancy Calculator In this PHP program we make a pregnancy calculator to tell parents to be exactly how pregnant they are in days and weeks, how long they have to wait until their due date, and what percentage of the pregnancy has passed. | Understanding Referential Integrity Referential integrity is a database concept that ensures that relationships between tables remain consistent. When one table has a foreign key to another table, the concept of referential integrity states that you may not add a record to the table that contains the foreign key unless there is a corresponding record in the linked table. It also includes the techniques known as cascading update and cascading delete, which ensure that changes made to the linked table are reflected in the primary table. | PHP: Rounding and Formatting Numbers Sometimes when you are rounding numbers you always want to round down. For example, if you are calculating how many people will fit in a boat safely, you can't carry .47 of a person, and you can't exceed the capacity. Therefore in this circumstance you would always round down. In PHP this is done with the floor () function. | | | | Related Searches | | | | Featured Articles | | | | | | | | Sign up for more free newsletters on your favorite topics | | | | You are receiving this newsletter because you subscribed to the About.com Programming newsletter. If you wish to change your email address or unsubscribe, please click here. About.com respects your privacy: Our Privacy Policy Contact Information: 1500 Broadway, 6th Floor New York, NY, 10036 © 2013 About.com | | | | | | Advertisement | |