Showing posts with label variable. Show all posts
Showing posts with label variable. Show all posts

Saturday, June 18, 2016

Using the static Statement to Remember the Value of a Variable Between Function Calls


If you declare a variable within a function in conjunction with the static statement, the variable remains local to the function, and the function "remembers" the value of the variable from execution to execution





<?php
function numberedHeading($txt) {
static $num_of_calls = 0;
$num_of_calls++;
echo "<h1>".$num_of_calls." ". $txt."</h1>"; }
numberedHeading("Mobile Phones");
echo "<p>We build a fine range of mobile phones.</p>";
numberedHeading("Camera");
echo "<p>Also Digital Cameras..</p>";
?>

The numberedHeading() function has become entirely self-contained. When we declare the $num_of_calls variable on line 3, we assign an initial value to it. This assignment is made when the function is first called on line 7. This initial assignment is ignored when the function is called a second time on line 9. Instead, the code remembers the previous value of $num_of_calls. We can now paste the numberedHeading() function into other scripts without worrying about global variables.

Thursday, May 19, 2016

Variable and Constant Meeting 3

Now, we are learning on variables and constants in PHP. TPlease pay attention to the scripts below:

<h3>Variables & Constant</h3>
<hr><h4>Employees Data</h4>
<?php
$id = 19200; $name = "Mr. Bean"; $address = "Jl. Godean Gg. II/4";
define("city", "Yogyakarta");
print("ID : $ID<br>");
print("Employees Name : $name<br>");
print("Address : $address<br>");
printf("City : %s<br>",city);
?>
<br><br><hr>
<h4>Calculating A Circle</h4>
<?php
$rad = 10; define("phi",3.14);
printf("Circle radiant : %s cm<br>",$rad);
printf("Area of a aircle : %s cm<sup>2</sup><br>",($rad*$rad*phi));
printf("Circumference of a circle : %s cm<br>", (2*phi*$rad));
?>

As before, save it as two.php and then open the file via browser. And the result should be like this:


For variables we know from the previous lesson that it must be started with $. But for constant we need to use a function "define" with 2 parameters as you can see above. The first parameter is the name of the constant and the second is the value of the constant.

Please pay attention to each line of commands and refer to the result so that you can analyse what a function is for.

As usual, any questions can be addressed via comments and so do the answers. See you in the next lessons.

Friday, May 13, 2016

Variable Scope

A variable declared within a function remains local to that function. In other words, it will not be available outside the function or within other functions. In larger projects, this can save you from accidentally overwriting the contents of a variable when you declare two variables with the same name in separate functions.

Create a variable within a function and then attempts to print it outside the function:
<?php
 function test() {
      $testvariable = "this is a test variable";
 }
 echo "test variable: ".$testvariable."<br/>";
 ?>
Put these lines into a text file called scopetest.php and place this file in your web server document root. When you access this script through your web browser, it should look like 




By the Way
The exact output you see depends on your PHP error settings. That is, it may or may not produce a "notice" as shown, but it will show the lack of an additional string after "test variable".
The value of the variable $testvariable is not printed because no such variable exists outside the test() function. Remember that the attempt in line 5 to access a nonexistent variable produces a notice such as the one displayed only if your PHP settings are set to display all errors, notices, and warnings; if your error settings are not strictly set, only the string "test variable" will be shown.
Similarly, a variable declared outside a function will not automatically be available within it.


Friday, March 4, 2016

Calculus Early Transcendentals Single Variable 9th Edition by Howard Anton

 

Download ebook Calculus Early Transcendentals Single Variable 9th Edition by Howard Anton

download-ebook-Calculus-9th-Edition-by-Howard-Anton
download-ebook-Calculus-9th-Edition-by-Howard-Anton

Designed for the undergraduate Calculus I-II-III sequence, Calculus, 9e continues to evolve to fulfill the needs of a changing market by providing flexible solutions to teaching and learning needs of all kinds. The new ninth edition of Calculus Early Transcendentals Single Variable retains the strengths of earlier editions such as Antons trademark clarity of exposition, sound mathematics, excellent exercises and examples, and appropriate level. Anton also incorporates new ideas that have withstood the objective scrutiny of many skilled and thoughtful instructors and their students. 

Table of Contents

Chapter 0 Before Calculus
0.1 Functions
0.2 New Functions from Old
0.4 Families of Functions
0.5 Inverse Functions; Inverse Trigonometric Functions
0.6 Exponential and Logarithmic Functions
Chapter 1 Limits and Continuity
1.1 Limits (An Intuitive Approach)
1.2 Computing Limits
1.3 Limits at Infinity; End Behavior of a Function
1.4 Limits (Discussed More Rigorously)
1.5 Continuity
1.6 Continuity of Trigonometric, Exponential, and Inverse Functions

Chapter 2 The Derivative
2.1 Tangent Lines and Rates of Change
2.2 The Derivative Function
2.3 Introduction to Techniques of Differentiation
2.4 The Product and Quotient Rules
2.5 Derivatives of Trigonometric Functions
2.6 The Chain Rule

Chapter 3 Topics in Differentiation
3.1 Implicit Differentiation
3.2 Derivatives of Logarithmic Functions
3.3 Derivatives of Exponential and Inverse Trigonometric Functions
3.4 Related Rates
3.5 Local Linear Approximation; Differentials
3.6 LHôpitals Rule; Indeterminate Forms

Chapter 4 The Derivative in Graphing and Applications
4.1 Analysis of Functions I: Increase, Decrease, and Concavity
4.2 Analysis of Functions II: Relative Extrema; Graphing Polynomials
4.3 Analysis of Functions III: Rational Functions, Cusps, and Vertical Tangents
4.4 Absolute Maxima and Minima
4.5 Applied Maximum and Minimum Problems
4.6 Rectilinear Motion
4.7 Newtons Method
4.8 Rolles Theorem; Mean-Value Theorem

Chapter 5 Integration
5.1 An Overview of the Area Problem
5.2 The Indefinite Integral
5.3 Integration by Substitution
5.4 The Definition of Area as a Limit; Sigma Notation
5.5 The Definite Integral
5.6 The Fundamental Theorem of Calculus
5.7 Rectilinear Motion Revisited Using Integration
5.8 Average Value of a Function and its Applications
5.9 Evaluating Definite Integrals by Substitution
5.10 Logarithmic and Other Functions Defined by Integrals

Chapter 6 Applications of the Definite Integral in Geometry, Science, and Engineering
6.1 Area Between Two Curves
6.2 Volumes by Slicing; Disks and Washers
6.3 Volumes by Cylindrical Shells
6.4 Length of a Plane Curve
6.5 Area of a Surface of Revolution
6.6 Work
6.7 Moments, Centers of Gravity, and Centroids
6.8 Fluid Pressure and Force
6.9 Hyperbolic Functions and Hanging Cables

Ch 7  Principles of Integral Evaluation
7.1 An Overview of Integration Methods
7.2 Integration by Parts
7.3 Integrating Trigonometric Functions
7.4 Trigonometric Substitutions
7.5 Integrating Rational Functions by Partial Fractions
7.6 Using Computer Algebra Systems and Tables of Integrals
7.7 Numerical Integration; Simpsons Rule
7.8 Improper Integrals

Ch 8  Mathematical Modeling with Differential Equations
8.1 Modeling with Differential Equations
8,2 Separation of Variables
8.3 Slope Fields; Eulers Method
8.4 First-Order Differential Equations and Applications

Ch 9  Infinite Series
9.1 Sequences
9.2 Monotone Sequences
9.3 Infinite Series
9.4 Convergence Tests
9.5 The Comparison, Ratio, and Root Tests
9.6 Alternating Series; Absolute and Conditional Convergence
9.7 Maclaurin and Taylor Polynomials
9.8 Maclaurin and Taylor Series; Power Series
9.9 Convergence of Taylor Series
9.10 Differentiating and Integrating Power Series; Modeling with Taylor Series


Ch 10  Parametric and Polar Curves; Conic Sections
10.1 Parametric Equations; Tangent Lines and Arc Length for Parametric Curves
10.2 Polar Coordinates
10.3 Tangent Lines, Arc Length, and Area for Polar Curves
10.4 Conic Sections
10.5 Rotation of Axes; Second-Degree Equations
10.6 Conic Sections in Polar Coordinates 


download-ebook-Calculus-9th-Edition-by-Howard-Anton
download-ebook-Calculus-9th-Edition-by-Howard-Anton

download-ebook-Calculus-9th-Edition-by-Howard-Anton
sample-page-download-ebook-Calculus-9th-Edition-by-Howard-Anton

download-ebook-Calculus-9th-Edition-by-Howard-Anton
sample-page-download-ebook-Calculus-9th-Edition-by-Howard-Anton



                           Download This Book for Free

Saturday, February 13, 2016

PHP Variable www php net

The Content in this ebook is copied from www.php.net
Copyright © 2001-2012 The PHP Group

Content
  • Introduction
  • Booleans
  • Integers
  • Floating point numbers
  • Strings
  • Arrays
  • Objects
  • Resources
  • NULL
  • Callbacks
  • Pseudo-types and variables used in this documentation
  • Type Juggling


NameWebsiteTypeSize
PHP Variablewww.php.netPDF3 MB

Click Here To Download