======length====== Get the length of a [[PTPScript:Types:String|String]] or [[PTPScript:Types:Number|Number]], or the number of items in an [[PTPScript:Types:Array|Array]]. \\ **Syntax** * ''[[PTPScript:Types:Number|Number]] length( [[PTPScript:Types:Mixed|Mixed]] subject [, [[PTPScript:Types:Boolean|Boolean]] recurse ] )'' \\ **Parameters** * [[PTPScript:Types:Mixed|Mixed]] ''subject'' - The entity to get the length of. This can be any PTPScript [[PTPScript:Types|data type]]. * [[PTPScript:Types:String|String]] - The length of the String will be returned. * [[PTPScript:Types:Number|Number]] - The Number will be treated as a String. * [[PTPScript:Types:Boolean|Boolean]] - The Boolean will be returned as a Number. * [[PTPScript:Types:Array|Array]] - The number of items in the Array will be returned. * [[PTPScript:Types:Boolean|Boolean]] ''recurse'' - The optional ''recurse'' parameter only has any effect if ''subject'' is an Array. * **''false''** (default) - Only items in the immediate Array will be counted. * **''true''** - The Array will be counted recursively, i.e. sub-Arrays will be counted too. \\ **Result** * [[PTPScript:Types:Number|Number]] - The length of ''subject'', or how many items it contains. Returns the length of ''subject''. If ''subject'' is a String, the length of the String will be returned. Numbers will be treated as Strings, and Booleans return their numeric equivalent. If ''subject'' is an Array, the number of items it contains will be returned.