An ultrafast all-optical differentiator generating the first- and the second-order temporal derivative of the intensity of optical signals is presented in this paper. Differentiation is obtained via an optical fiber that plays the role of an optical phase modulator, an optical bandpass filter and a photodetector. The operation of the proposed device is theoretically studied in order to highlight significant parameters that affect the performance of the differentiator, namely the filter transfer function, the power of the propagating waves and the fiber characteristics (length and nonlinear coefficient). The comparison between the numerically calculated derivatives and the theoretically expected ones is performed by estimating the correlation coefficient between them. According to the numerical analysis, high correlation coefficients can be achieved in certain operating regimes. The same device can be utilized in order to produce ultrawideband (UWB) impulse signals. Electrical monocycle or doublet pulses can be obtained at the output of the photodetector (PD) using the proper tunable optical filter. Experimental verification of the theoretically predicted and numerically calculated results is finally presented for high bit-rate signals.