How to check weather a variable contains serialized data or not

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • mosesdinakaran@gmail.com

    How to check weather a variable contains serialized data or not


    Hi,

    Is there a way to check weather a variable contains serialized
    data or not, as we hve some functions like
    ( is_ double,is_ float) to check the integer and float value.


    Moses

  • Rik

    #2
    Re: How to check weather a variable contains serialized data or not

    mosesdinakaran@ gmail.com wrote:
    Hi,
    >
    Is there a way to check weather a variable contains serialized
    data or not, as we hve some functions like
    ( is_ double,is_ float) to check the integer and float value.
    >
    Very messy, but I have to admit I've used it:

    function is_serialized($ var){
    $check = @unserialize($v ar);
    return ($check===false && $var != serialize(false )) ? false : true;
    }

    --
    Rik Wasmus

    Estimated date being able to walk again: 01-05-2007.
    Less then a week, hurray!

    Comment

    Working...