Well, you can tell by looking at the format. When you serialize the array, you get a line that looks like a:1:{i:0;s:3:"foo"} And if you serialize the object, you get: o:7:"myclass":1:{s:3:"foo";s:3:"bar";} .
So, if you want to test the rudimentary, you can execute these two regular expressions:
^a:\d+:{.*?}$
and
^o:\d+:"[a-z0-9_]+":\d+:{.*?}$
for arrays and objects respectively.
Please note that this just checks the general form. To find out if this is a valid sequential string, you need to run it through unserialize() and check the inverse of is_array($result) and is_object($result) ...
source share