Giải trình. Hàm preg_grep[] được sử dụng để tìm kiếm một mảng cho các mẫu cụ thể và sau đó trả về một mảng mới dựa trên bộ lọc đó
Câu hỏi 2
Array[[2]=>one [3]=>two [4]=>three]07
Array[[2]=>one [3]=>two [4]=>three]08
Array[[2]=>one [3]=>two [4]=>three]09
Array[[2]=>one [3]=>two [4]=>three]0
Array[[2]=>one [3]=>two [4]=>three]1
Array[[2]=>one [3]=>two [4]=>three]2
Array[[2]=>one [3]=>two [4]=>three]08
Array[[2]=>one [3]=>two [4]=>three]4
Array[[2]=>one [3]=>two [4]=>three]5
Array[[2]=>one [3]=>two [4]=>three]6
Array[[2]=>one [3]=>two [4]=>three]7
Array[[2]=>one [3]=>two [4]=>three]09
My name is not Sagar Shukla7
Array[[2]=>one [3]=>two [4]=>three]08
My name is Sagar Shukla1
Array[[2]=>one [3]=>two [4]=>three]4
Array[[2]=>one [3]=>two [4]=>three]9
My name is Sagar Shukla4
Tùy chọn
- Mảng[[0]=>0 [1]=>1 [2]=>một [3]=>hai [4]=>ba [5]=>5]
- Mảng[[2]=>một [3]=>hai [4]=>ba]
- Mảng[[1]=> 1]
- Mảng[[0]=>0 [1]=>1 [5]=>5]
đầu ra
Array[[2]=>one [3]=>two [4]=>three]
Giải trình. Khi chúng tôi bao gồm PREG_GREP_INVERT, điều này sẽ đảo ngược dữ liệu của chúng tôi, vì vậy thay vì xuất ra các số, nó sẽ xuất ra các giá trị không phải là số của chúng tôi
câu hỏi 3
Array[[2]=>one [3]=>two [4]=>three]07
Array[[2]=>one [3]=>two [4]=>three]08
Array[[2]=>one [3]=>two [4]=>three]35
Array[[2]=>one [3]=>two [4]=>three]0______137
Array[[2]=>one [3]=>two [4]=>three]38
Array[[2]=>one [3]=>two [4]=>three]08
Array[[2]=>one [3]=>two [4]=>three]70
Array[[2]=>one [3]=>two [4]=>three]71
Array[[2]=>one [3]=>two [4]=>three]72
Array[[2]=>one [3]=>two [4]=>three]7
Array[[2]=>one [3]=>two [4]=>three]35
Array[[2]=>one [3]=>two [4]=>three]75
________ 108 ________ 177 ________ 178 ________ 138
Array[[2]=>one [3]=>two [4]=>three]08
Array[[2]=>one [3]=>two [4]=>three]61
Array[[2]=>one [3]=>two [4]=>three]08
Array[[2]=>one [3]=>two [4]=>three]77
Array[[2]=>one [3]=>two [4]=>three]64
Array[[2]=>one [3]=>two [4]=>three]38
My name is Sagar Shukla4
Tùy chọn
- Tên tôi là Sagar Shukla
- Tên tôi không phải là Sagar Shukla
- Lỗi
- không có đầu ra
đầu ra
________số 8Giải trình. Mã này sử dụng preg_match[] để kiểm tra từ khóa và trả lời dựa trên việc từ khóa đó đúng [1] hay sai [0]
câu hỏi 4
Array[[2]=>one [3]=>two [4]=>three]07
Array[[2]=>one [3]=>two [4]=>three]08
Array[[2]=>one [3]=>two [4]=>three]35
Array[[2]=>one [3]=>two [4]=>three]0______137
Array[[2]=>one [3]=>two [4]=>three]38
Array[[2]=>one [3]=>two [4]=>three]08
Array[[2]=>one [3]=>two [4]=>three]70
Array[[2]=>one [3]=>two [4]=>three]71
Array[[2]=>one [3]=>two [4]=>three]076
Array[[2]=>one [3]=>two [4]=>three]7
Array[[2]=>one [3]=>two [4]=>three]35
Array[[2]=>one [3]=>two [4]=>three]75
________ 108 ________ 177 ________ 178 ________ 138
Array[[2]=>one [3]=>two [4]=>three]08
Array[[2]=>one [3]=>two [4]=>three]61
Array[[2]=>one [3]=>two [4]=>three]08
Array[[2]=>one [3]=>two [4]=>three]77
Array[[2]=>one [3]=>two [4]=>three]64
Array[[2]=>one [3]=>two [4]=>three]38
My name is Sagar Shukla4
Tùy chọn
- Tên tôi là Sagar Shukla
- Tên tôi không phải là Sagar Shukla
- Lỗi
- không có đầu ra
đầu ra
My name is not Sagar Shukla
Giải trình. Đoạn mã sử dụng preg_match để kiểm tra một từ khóa và trả lời dựa trên việc từ đó đúng [1] hay sai [0]
câu hỏi 5
Array[[2]=>one [3]=>two [4]=>three]07
________ 108 ________ 1093 ________ 00 ________ 1095 ________ 138
Array[[2]=>one [3]=>two [4]=>three]08
Array[[2]=>one [3]=>two [4]=>three]098
Array[[2]=>one [3]=>two [4]=>three]0_______01
Array[[2]=>one [3]=>two [4]=>three]01
Array[[2]=>one [3]=>two [4]=>three]02
Array[[2]=>one [3]=>two [4]=>three]9
Array[[2]=>one [3]=>two [4]=>three]08
Array[[2]=>one [3]=>two [4]=>three]05
Array[[2]=>one [3]=>two [4]=>three]0_______01
Array[[2]=>one [3]=>two [4]=>three]01
Array[[2]=>one [3]=>two [4]=>three]09
Array[[2]=>one [3]=>two [4]=>three]9
Array[[2]=>one [3]=>two [4]=>three]08
Array[[2]=>one [3]=>two [4]=>three]77
Array[[2]=>one [3]=>two [4]=>three]13
Array[[2]=>one [3]=>two [4]=>three]098
Array[[2]=>one [3]=>two [4]=>three]7
Array[[2]=>one [3]=>two [4]=>three]05
Array[[2]=>one [3]=>two [4]=>three]7
Array[[2]=>one [3]=>two [4]=>three]093
Array[[2]=>one [3]=>two [4]=>three]9
My name is Sagar Shukla4
Tùy chọn
- Tôi đang thực tập tại GeekforGeeks
- Tôi đã thực tập tại GeekforGeeks
- Lỗi
- không có đầu ra
đầu ra
Array[[2]=>one [3]=>two [4]=>three]3
Giải trình. Trong chương trình trên, am được thay thế bằng was as preg Hàm PHP được sử dụng để tìm và thay thế trên một chuỗi hoặc một mảng
câu hỏi 6
Array[[2]=>one [3]=>two [4]=>three]07
________ 108 ________ 1093 ________ 00 ________ 1095 ________ 138
Array[[2]=>one [3]=>two [4]=>three]08
Array[[2]=>one [3]=>two [4]=>three]098
Array[[2]=>one [3]=>two [4]=>three]0_______01
Array[[2]=>one [3]=>two [4]=>three]01
Array[[2]=>one [3]=>two [4]=>three]32
Array[[2]=>one [3]=>two [4]=>three]9
Array[[2]=>one [3]=>two [4]=>three]08
Array[[2]=>one [3]=>two [4]=>three]05
Array[[2]=>one [3]=>two [4]=>three]0_______01
Array[[2]=>one [3]=>two [4]=>three]01
Array[[2]=>one [3]=>two [4]=>three]39
Array[[2]=>one [3]=>two [4]=>three]9
Array[[2]=>one [3]=>two [4]=>three]08
Array[[2]=>one [3]=>two [4]=>three]77
Array[[2]=>one [3]=>two [4]=>three]13
Array[[2]=>one [3]=>two [4]=>three]098
Array[[2]=>one [3]=>two [4]=>three]7
Array[[2]=>one [3]=>two [4]=>three]05
Array[[2]=>one [3]=>two [4]=>three]7
Array[[2]=>one [3]=>two [4]=>three]093
Array[[2]=>one [3]=>two [4]=>three]9
My name is Sagar Shukla4
Tùy chọn
- Tôi đang thực tập tại GeekforGeeks
- Tôi đang thực tập tại GEEKSFORGEEKS
- Lỗi
- không có đầu ra
đầu ra
Array[[2]=>one [3]=>two [4]=>three]7
Giải trình. GeekforGeek không được thay thế vì chức năng preg_replace phân biệt chữ hoa chữ thường. Do đó, nó đối xử với GeeksforGeeks và geeksforgeeks khác nhau
câu hỏi 7
Array[[2]=>one [3]=>two [4]=>three]07
Array[[2]=>one [3]=>two [4]=>three]08
Array[[2]=>one [3]=>two [4]=>three]53
Array[[2]=>one [3]=>two [4]=>three]0_______055
Array[[2]=>one [3]=>two [4]=>three]38
Array[[2]=>one [3]=>two [4]=>three]08
Array[[2]=>one [3]=>two [4]=>three]58
Array[[2]=>one [3]=>two [4]=>three]59
Array[[2]=>one [3]=>two [4]=>three]60
Array[[2]=>one [3]=>two [4]=>three]7
Array[[2]=>one [3]=>two [4]=>three]53
Array[[2]=>one [3]=>two [4]=>three]9
Array[[2]=>one [3]=>two [4]=>three]08
My name is Sagar Shukla1____058
Array[[2]=>one [3]=>two [4]=>three]9
My name is Sagar Shukla4
Tùy chọn
- Xin chào. Chào mừng đến với GeekforGeek
- Mảng[[0]=> Xin chào. Chào mừng đến với GeekforGeek. ]
- Array[[0]=> Xin chào [1]=> Chào mừng đến với GeeksforGeeks. ]
- Lỗi
đầu ra
Array[[2]=>one [3]=>two [4]=>three]6
Giải trình. Chúng tôi sử dụng một ‘. ' thời gian để phân chia dữ liệu, do đó cung cấp cho mỗi câu đó là mục nhập mảng riêng