Some exercise in php about string manipulations without using the right php functions