Multiply two integers without using multiplication , division and bitwise operators , and no loops | function to multiply two numbers x and y ; 0 multiplied with anything gives 0 ; Add x one by one ; the case where y is negative ; Driver Code
< ? php function multiply ( $ x , $ y ) { if ( $ y == 0 ) return 0 ; if ( $ y > 0 ) return ( $ x + multiply ( $ x , $ y - 1 ) ) ; if ( $ y < 0 ) return - multiply ( $ x , - $ y ) ; } echo multiply ( 5 , -11 ) ; ? >