Fri, 17 May 2024


How to set explicitly the type of a PHP variable?

By: Nathalie, NetArt Media
Wed, 17 November 2021

You can do this by using the special PHP function settype, the syntax is settype(string var, string type).

Type could be "integer", "double", "string", "array" or "object" Be aware that settype returns true if the operation has completed
successfully.


Category: PHP Examples
Share this post:



See All Scripts






Subscribe for our newsletter

Receive the latest blog posts direct in your mailbox