PHP 5/MySQL Programming- P45

PHP 5/MySQL Programming- P45: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 | 198 PHP 5 MySQL Programming for the Absolute Beginner Table summarizes the main regular expression elements. Table Summary of Expression Opei Basic Regular rato RS Operator Description Sample Pattern Matches Doesn t match . any character but newline e n A beginning of string Aa apple banana end of string a banana apple characters any characters in braces abcABC a d char range describe range of characters a-zA-z r 9 d any digit d d d- d d d d 123-4567 the-thing b word boundary bthe b the theater one or more occurrences of preceding character d 1234 text zero or more occurrences of preceding character a-zA-z d digit repeat preceding character that many times d 3 - d 4 123-4567 999-99-9999 1 or operator apple banana apple banana peach pattern segment store results in pattern memory returned with numeric code A. . 1 gig blab any word that starts and ends with same letter any other word Note that square braces can contain either characters or a range of characters as indicated in the examples. To illustrate I explain how the jpg gif expression works. The expression jpg gif matches on any string that ends with jpg or gif. Slashes usually mark the beginning and end of regular expressions. The first and last characters of the expression are these slashes. 199 The pipe character indicates or so I m looking for jpg or gif. The dollar sign indicates the end of a string in the context of regular expressions so jpgS only matches on the value jpg if it s at the end of a string. Regular expressions are extremely powerful if a bit cryptic. PHP supports a number of special functions that use regular expressions in addition to preg_grep. Look in the online Help under Regular Expression Functions Perl compatible for a list of these functions as well as details on how regular expressions work in PHP. If you find regular expressions baffling you can usually find a stringmanipulation function or two that does the same general job. Storing the Output Once the SimageFiles array is

Không thể tạo bản xem trước, hãy bấm tải xuống
Đã 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.