Hướng dẫn dùng pad a trong PHP
Hàm Show Bài viết này được đăng tại freetuts.net, không được copy dưới mọi hình thức. Cú phápCú pháp: Trong đó:
Ví dụCode $input = "Freetuts.net"; echo str_pad($input, 20) ." Kết quả Freetuts.net -=-=-=-=Freetuts.net ____Freetuts.net____ Freetuts.net_ Freetuts.net Tham khảo: php,net Bài viết này được đăng tại [free tuts .net] Định nghĩa hàm array_pad() trong PHPHàm Cú pháp hàm array_pad() trong PHP__Hàm
Nếu Tham số
Trả về giá trị Nó trả về mảng kết quả. Ví dụ minh họa cách sử dụng hàm array_pad() trong PHP:
Lưu chương trình trên trong một file có tên là test.php trong htdocs, sau đó mở trình duyệt và gõ địa chỉ http://localhost:8080/test.php sẽ cho kết quả: Xem thêm Hàm trong php
Hướng dẫn cách sử dụng hàm array_pad() về mảng trong lập trình PHP Tác dụng của hàm array_pad()The The following table summarizes the technical details of this function.
SyntaxThe basic syntax of the array_pad(array, size, value); The following example shows the
ParametersThe
More ExamplesHere're some more examples showing how If size is positive then the array is padded on the right, if it's negative then padded on the left.
If the absolute value of size is less than or equal to the array's length then no padding takes place.
Bài viết này đã giúp ích cho bạn?Bài viết mới |