TAILIEUCHUNG - ICT 5 Web Development - Chapter 3.2: Functions

ICT 5 Web Development - Chapter : Functions Basic PHP Functions, Write your own functions, Using External Script Files, The abs Functionabs, The sqrt Function, The round Function, The datedate Function, Function definition. | Vietnam and Japan Joint ICT HRD Program Objectives To learn to use several PHP functions useful for Web application d f lf b l development l To learn to write and use your own functions ITC 5 – Web Programming Chapter 3-2. Functions Nguyen Thi Thu Trang trangntt@ 2 Content Content 1. Basic PHP Functions 2. Write your own functions 3. Using External Script Files 1. Basic PHP Functions 2. Write your own functions 3. Using External Script Files 3 4 1 1. Basic PHP Functions Numberic PHP Functions We previously discussed functions such as strlen(), trim(), strtolower(), strtoupper(), and substr(). In this section we examine several other useful functions including – Some basic numeric PHP functions ., ., the absolute value[abs()], square root [sqrt()], round [round()], integer checker[is_numeric()], and random number generation [rand()] functions. – The print() function Absolute value Square root, Round, Integer checker Random number generation We will cover in more detail – The date() function We will discuss using the date() function to determine date and time information. 5 6 . The abs() Function . The sqrt() Function The absolute value function takes a single numerical argument and returns its absolute value. For example, the following The square root function takes a single q g numerical argument and returns its square root. For example, the following $x=sqrt(25); $y=sqrt(24); print "x=$x y=$y"; $x=abs($x=abs(-5); $y=abs(42); print "x=$x y=$y"; Will output Will output – x=5 y= – x=5 y=42 7 8 2 . The round() Function . The round() Function The round function takes a single numerical g argument and returns the number rounded up or down to the nearest integer. For example, the following You can include 2nd argument to define the number of digits after the decimal point to round to. For example, $x=round($x=round(); $y=round(); print "x=$x .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.