PHP String Functions

<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Document</title></head><body><?php//String Function$str = "hello world";echo strlen($str); // string lengthecho "<br>";echo str_word_count($str); // the count of word -> hello + world = 2echo "<br>";echo strrev($str); // string reverse -> hello world => dlrow ollehecho "<br>";echo strpos($str, "world"); // string position => 6echo "<br>";echo str_replace("world","leaf",$str); // leaf -> world => hello leaf?></body></html>



NTUT CSIE | Biomedical Informatics Lab | |

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store