How can the memory_limit parameter in the php.ini file affect PHP performance and memory usage?

Setting the memory_limit parameter in the php.ini file can affect PHP performance and memory usage by limiting the amount of memory that PHP scripts can consume. If the memory_limit is set too low, it can cause scripts to run out of memory and crash. On the other hand, setting it too high can lead to excessive memory usage and potential performance issues. It's important to find a balance that allows scripts to run efficiently without consuming too much memory.

// Example of setting memory_limit in PHP script
ini_set('memory_limit', '128M');