PHP, setcookie , Cookie?  PHP setcookie function limitation.

PHP, setcookie , Cookie? PHP setcookie function limitation.

Do you surprise? we cannot use PHP setcookie() function in any place we like of whole code,
for example1:




iphone test cookie








It displays Warning message:
Warning: Cannot modify header information – headers already sent by (output started at C:\xampp\htdocs\iphone\testcookie.php:4) in C:\xampp\htdocs\testcookie.php on line 5

——————————————-
Solution 1: if we change the code like below, it could working,
the problem is setcookie() function,
$_COOKIE[“TestCookie”]; reading function is working well,












——————————————-
Solution 2: Use ob_start() function