Rotations of a Binary String with Odd Value | function to calculate total odd decimal equivalent ; Driver code
< ? php function oddEquivalent ( $ s , $ n ) { $ count = 0 ; for ( $ i = 0 ; $ i < $ n ; $ i ++ ) { if ( $ s [ $ i ] == '1' ) $ count ++ ; } return $ count ; } $ s = "1011011" ; $ n = strlen ( $ s ) ; echo ( oddEquivalent ( $ s , $ n ) ) ; ? >