top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

strlen of a non existing variable in PHP

+1 vote

I have a code in PHP something like this

 if (strlen($profile['current-employer']) == 0)
     return a;

Now in some cases $profile['current-employer'] can be non-existent, now here my question is in the case of non-existent variable what strlen will result... (This is related with QueryHome code)

posted Nov 7, 2013 by Salil Agrawal

Share this question
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button

1 Answer

0 votes

strlen of a non-existing variable is zero :)

answer Nov 8, 2013 by Deepankar Dubey
Similar Questions
0 votes

Trying to manage line breaks in some output I'm generating and using strlen to measure the lengths of the strings I'm printing. Discovered something strange (to me!) in that strlen is returning +1 more than it

The strings are from a query of my database - simple name fields. But everyone of them is coming back with a length that is one more than I see.

0 votes

Have two questions -
1. How to find type of a variable in PHP.
2. How to find the type of an array in PHP.

Please help.

0 votes

PHP:: Suppose I am trying to assign a variable the value of 0123, but it keeps coming up with a different number, whats the problem?

Contact Us
+91 9880187415
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Karnataka INDIA.