PHP 5/MySQL Programming- P27

PHP 5/MySQL Programming- P27:computer programming has often been seen as a difficult and arcane skill. Programming languages are difficult and complicated, out of the typical person’s reach. However, the advent of the World Wide Web has changed that to some extent. It’s reasonably easy to build and post a Web page for the entire world to see. The language of the Web is reasonably simple, and numerous applications are available to assist in the preparation of static pages | 108 PHP 5 MySQL Programming for the Absolute Beginner First look over the entire program then see how it does its work. html head title Basic Array title head body h1 Basic Array h1 simply assign values to array camelPop 1 Somalia camelPop 2 Sudan camelPop 3 Mauritania camelPop 4 Pakistan camelPop 5 India output array values print h3 Top Camel Populations in the World h3 n for i 1 i 5 i print i camelPop i br n end for loop print i Source a href http ag aga glipha Food and Agriculture Organization of the United Nations a i n use array function to load up array binary array 000 001 010 011 print h3 Binary numbers h3 n for i 0 print i i count binary i binary i br n end for loop body html Generating a Basic Array Look at the lines that describe camelPop simply assign values to array camelPop 1 Somalia camelPop 2 Sudan camelPop 3 Mauritania camelPop 4 Pakistan camelPop 5 India The camelPop variable is a variable meant to hold the five countries with the largest camel populations in the world. If this array stuff isn t working for you at least you ve learned something in this chapter Since camelPop is going to hold the names of five different countries it makes sense that this is an array computer geek lingo for list rather than an ordinary variable. The only thing different about camelPop and all the other variables you ve worked with so far is camelPop can have multiple values. To tell these values apart use a numeric index in square brackets. Chapter 4 Loops and Arrays Apparently the boxer George Foreman has several sons also named George. I ve often wondered what Mrs. Foreman does when she wants somebody to take out the trash. I suspect she has assigned a number to each George so there is no ambiguity. This is exactly how arrays work. Each element has the same name but a different numerical index so you can tell them apart. Many languages require you to explicitly create array variables but PHP is very easygoing in this regard. Simply assign a .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
78    76    2    29-03-2024
Đã 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.