if Khaled used atoi() to convert a string to an integer, bob will always return 0. (because there is no numeric char)

5bob should returns 5.

It's the same with $chan, but the algorithm must check first if the first letter is a #. If it is not, it converts the string to an int ( so "blahblah" becomes 0). Else it looks for the specified chan.