TAILIEUCHUNG - PHP and MySQL by Example- P11

Tham khảo tài liệu 'php and mysql by example- p11', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Figure . Splitting with multiple delimiters. Output from Example . Example . php 1 alpha SAN FRANCISCO 2 array preg_split alpha -1 PREG_SPLIT_NO_EMPTY echo h2 Splitting A Word into Letters h2 3 print_r array Explanation 1 This is the string that will be split up. Please purchase PDF Split-Merge on to remove this watermark. 2 By using an empty delimiter preg_spiit will split up the string by its individual characters. The preg_split_no_empty flag causes the function to return an array without any empty elements. 3 The array of letters created by splitting on an empty delimiter is displayed as an array by the print_r function shown in Figure . Figure . Splitting up a word with the preg split function. Output from Example . Example . php 1 alpha PORT OF SAN FRANCISCO Please purchase PDF Split-Merge on to remove this watermark. 2 array preg_split s alpha -1 PREG_SPLIT_OFFSET_CAPTURE echo h2 Splitting A Word into Letters h2 print_r array Explanation 1 This is the string we will be splitting on line 2. 2 The preg_split function takes a number of arguments. In this example the first argument is the delimiter. s represents a whitespace character. The second argument is the string that is being split alpha. The third argument normally omitted is -1 stating that there is no limit to the number of array elements that can be created when splitting up this string. The preg_split_offset_capture flag says that for every array element created the offset of where it occurred within the string will also be returned. You can see in the output of this example Figure that each substring is an array element and its offset within the string is another array consisting of two elements the array element substring and the offset position of where that substring was found in the original string. Please purchase PDF Split-Merge on to remove this .

TỪ KHÓA LIÊN QUAN
Đã 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.