admin 發表於 2020-10-15 17:37:38

String Functions

String 長度:
<?php
echo strlen("Hello world!");
?>結果: 12

admin 發表於 2020-10-15 17:39:21

字數:
<?php
echo str_word_count("Hello world!");
?>結果: 2

redd 發表於 2020-10-15 18:32:27

反轉:
<?php
echo strrev("Hello world!");
?>結果: !dlrow olleH

redd 發表於 2020-10-15 18:36:04

Search for a text within a string:
<?php
echo strpos("Hello world!", "world");
?>結果: 6

Tip: The first character position in a string is 0 (not 1).

redd 發表於 2020-10-15 18:52:23

取代:
<?php
echo str_replace("world", "Dolly", "Hello world!");
?>結果: Hello Dolly!
頁: [1]
查看完整版本: String Functions