in my traffic light project i need 1N4148 in its circuit but i can n't get it so is there an problem if i replace it with 1N4007 or they don't have the same function
The 1N914 switching diode is extremely similar to the 1N4148; so much so that they are generally interchangeable.
If the circuit in question will operate at low frequency, and if you have the room, then you can probably use a 1N400x series diode instead. If the circuit depends on fast recovery times, you should look at another diode.
Schottky diodes like the 1N5817 have extremely low recovery times.