PHP

Getting Started String Date If Else Loop Array Functions Session Files Super Global Variables Debugging MySQL MySQL Read Data JSON Markdown
O O

Weather Controls

Time Of Day
Rain
Wind Speed
Wind Direction
Clouds

PHP : String

2017-01-01

String

String

// String Length
strlen("Hello world!"); // outputs 12

// Word Count
str_word_count("Hello world!"); // outputs 2

// String Reverse 
echo strrev("Hello world!"); // outputs !dlrow olleH

// Search for string
echo strpos("Hello world!", "world"); // outputs 6

// string replace
echo str_replace("world", "Dolly", "Hello world!"); // outputs Hello Dolly!

Change Quotes(double/single) To HTML Characters So It Doesn't Explode When Trying To Save To DB

$body = isset($_REQUEST['body']) ? htmlspecialchars($_REQUEST['body'], ENT_QUOTES) : '';