What is the php equiv of the following test for a null string value
TIA and go Fiji this evening ....Code:$value = somefuntion($A, $B)
if not($value) then
* string is empty do processing
else
* string has a value rock on dude
end
Printable View
What is the php equiv of the following test for a null string value
TIA and go Fiji this evening ....Code:$value = somefuntion($A, $B)
if not($value) then
* string is empty do processing
else
* string has a value rock on dude
end
are you testing for a null value, or an empty string?
PHP Code:if(empty($value)){
// this value is an empty string -- ""
}else{
// this value is not an empty string
}
PHP Code:if(is_null($value)){
// this value == null
}else{
// this value != null
}
PHP Code:if($value === ""){
// $value is exactly equal to an empty string ("")
}else{
// $value is not an empty string
}
you should be alright using empty() to test for an empty string and is_null() to test for a null value.PHP Code:if($value === null){
// $value is exactly equal to null
}else{
// $value is not null
}
Think empty() looks like what I'm after. Will test him out this morning and see how I go :wave: