Number of substrings of a string | PHP program to count number of substrings of a string ; Driver Code
< ? php function countNonEmptySubstr ( $ str ) { $ n = strlen ( $ str ) ; return $ n * ( $ n + 1 ) / 2 ; } $ s = " abcde " ; echo countNonEmptySubstr ( $ s ) ; ? >