Database design: keys, relationships and normalization
Design tables that avoid duplicated data: primary keys, foreign keys, one-to-many and many-to-many relationships.
The string functions you will reach for every day.
<?php
$s = ' Hello PHP World ';
$t = trim($s); // 'Hello PHP World'
echo strlen($t); // 15
echo strtoupper($t); // HELLO PHP WORLD
echo ucwords('mary jane'); // Mary Janeecho str_contains($t, 'PHP') ? 'yes' : 'no'; // yes
echo substr($t, 0, 5); // Hello
echo strpos($t, 'PHP'); // 6
echo str_replace('World', 'Team', $t);$parts = explode(',', 'a,b,c'); // ['a','b','c']
echo implode(' | ', $parts); // a | b | cstrlen('اردو') counts bytes, not letters. For Urdu, Arabic or accented text use the mb_ versions: mb_strlen, mb_substr, mb_strtoupper.
echo sprintf('%05d', 42); // 00042
echo number_format(1234567.891, 2); // 1,234,567.89Strings that come from users must be escaped with htmlspecialchars() before you print them in HTML.
Design tables that avoid duplicated data: primary keys, foreign keys, one-to-many and many-to-many relationships.
A folder layout and a few habits that keep a growing PHP site tidy, secure and easy to maintain.