我們常常會想要將英文字串全部轉成大寫或小寫,今天就是要來介紹這該如何達成!
首先就來看看將字串轉成大寫:
再來看將字串轉成小寫:
首先就來看看將字串轉成大寫:
- <?php
- $str = "Mary Had A Little Lamb.";
- $str = strtoupper($str);
- echo $str; // result: MARY HAD A LITTLE LAMB.
- ?>
再來看將字串轉成小寫:
- <?php
- $str = "Mary Had A Little Lamb.";
- $str = strtolower($str);
- echo $str; // result: mary had a little lamb.
- ?>
是不是很簡單呢~?
沒有留言:
張貼留言