It is well established that optical devices and components are more advantageous than their electronic counterparts because of inherent parallelism in optics. Basically electronics are found to be very unsuitable in high speed (above gigahertz) data processing systems whereas tremendous operational speed (in the range of terahertz) can be achieved with the help of optics. The parallelism of optics and the properties of low loss transmission make optics a powerful technology for digital computing and processing and in long-range communications. Again it is well established that logic gates are the basic building blocks of any computing or data processing system. Therefore, any optical data processor needs suitable optically run logic gates. A method of conducting phase-modulated all-optical logic gates is proposed. Here we will exploit the advantages of phase modulation not only in processing but also in encoding as well decoding also.