Jump to content

How to I use instanceof for native data types


HGeneAnthony

Recommended Posts

I know how to check to see if a variable is an instanceof a class that I define, however I don't know how to check if it's a string, int, double, etc.  Let's say this was my code how could I modify it to check if the data is a string:

 

$name = "gene";

if ($name instanceof string):

  echo "This is a string";

else:

  echo "This isn't a string";

endif;

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.