You are developing your career where upgrading yourself is must. Do not just rely on PHP or .NET or Android or whatever. May be you are a very good PHP coder. Knows so many things but you don't know everything. But I know you will not be able to know everything. But You must have to have the eagerness to learn new things. Suppose you are very good in PHP 4. But now PHP 6 is going to reign the PHP world but still you do not want to learn even PHP 5 and as a result you are not doing OOP just because upto PHP 4 OOP was not used that much!!! Then sorry. This is not your field. Suppose you are an advanced developer. Going to develop a chat script. But you dont have the guts to study on node.js instead you are finding a shortcut way to do it using database!!! sorry again. So just keep in mind only PHP will give nothing until you upgrade yourself. Today you are writing duplicate codes but you are continuing it projects after projects. You should not do this. You have to have the eagerness to follow the DRY (Do not Repeat Yourself) approach. Try to attach with online group, discussion, visit popular blogs or magazines to upgrade. Now it is the time to make rounded corner using CSS3 so please dont try to do it using photoshop to make a rounded corner image.
Search This Blog
Showing posts with label PHP. Show all posts
Showing posts with label PHP. Show all posts
Monday, September 24, 2012
Thursday, September 6, 2012
Define cookie path to access it everywhere in the domain
Sometimes programmers want their cookie variable available to all the pages in the domain but
they don’t specify the cookie path. To make the cookie variable in all
the pages in the domain one should set the cookie as
below–setcookie(name of the variable,value of the cookie
variable,expired time of cookie,path)the path should be “/”. If you do this way the cookie should be available all the way to the domain.
Example code : setcookie(“Name”,”Fuad”,time()+3600*24,”/”)
Example code : setcookie(“Name”,”Fuad”,time()+3600*24,”/”)
Thursday, August 30, 2012
PHP basics
1. In PHP 0 and FALSE are same when you will use == operator but not same when you will use === operator.=== operator checks the type and value so use === operator to check whether a function returns FALSE or not specially in case of those built in function those return FALSE in case of not finding desired result (e.g : stripos).
stripos returns FALSE if it can not find the desired needle in the haystack. so consider the following example.
//////////////////////////////
$haystack = "Basics of PHP";
$needle ="Basics";
if(stripos($haystack,$needle)==false)
echo "Match found";
///////////////////////////
This will output "Match found";
But the output should have been given if the the needle was not in the haystack. But since the needle (in this case "Basics") was in the 0 position of the haystack the stripos is returning 0. and we are using == operator . that means here false and 0 becomes same.
But if the code was like this
//////////////////////////////
$haystack = "Basics of PHP";
$needle ="Basics";
if(stripos($haystack,$needle)===false)
echo "Match found";
///////////////////////////
This will not output anything.
Subscribe to:
Posts (Atom)