I'm experimenting with explode and was using the below as a test...
I set a cookie (which all works) with $user having been input by the user.
I then want to explode this into each letter and if the first letter is J, to echo Hello! instead of Go away!!!
<?php
$parts = explode("",$user);
$part1 = $parts[0];
$part2 = $parts[1];
$part3 = $parts[2];
$part4 = $parts[3];
$part5 = $parts[4];
if ($part1 == "J") {echo "Hello!";}
else {echo "Go away!!!";}
?>
As you'd expect, above gives an error because of "", so I tried " ", but it still doesn't split it, what do I need to put there to split up a name input.
For IP of course, its ".", and it splits the IP, but for nothing what can I do?
Thanks for any help!