If your objective is to learn web development via PHP, MySQL, Apache or practice projects in your laptop or computer, then 4GB of RAM is more than sufficient for you. You will be installing XAMPP in your laptop and a normal editor, say Notepad++. You may probably need a FTP client software to upload your project files to a web server to make your project viewable publicly. So that you can put your learning projects in your resume. In such learner requirement, 4GB of RAM is more than sufficient.
If you are a professional freelancer or working in small company say 10 to 20 employees, then you will be working in real time projects for your clients. You need 8 GB of RAM. You will have your XAMPP setup with FTP client. Along with Notepad++, you will be having a decent PHP Editor to do faster coding. Your client might send the requirements in word document, where you need to open Microsoft Word or any other open source text editor. You might also uses Source Code Repository (say Git) client software to check-in or checkout project files, which depends on the client. Some client may prefer Git or some prefer direct access to server via FTP or Cpanel. In such freelancer requirement, 8GB of RAM is required.
If you are working in corporate or enterprise project, and want to use your laptop for office use, you will need 16 GB of RAM. You need to attend daily status calls using your laptop. You have to join audio or video call using your system. Often you will engage in screen share session with client to demonstrate your progress today. Definitely, you will be working with Git or any other source code repository. You have to undergo DevOps orchestration to get your code deployed in production. You might need to have Virtualization enabled in your laptop or system. Though you are still a PHP developer using XAMPP now with a licensed PHP Editor, your communication tools, DevOps requirements to undergo release process, Usage of Word, Excel, Powerpoint – say document, deck preparation – all require more RAM and CPU power. Or you might be using your laptop or system as thin client and connect to your client’s virtual machine to do your project related activities. Your virtual machine will have all the necessary software required to work in the project. Hence, If you are PHP developer, working in corporate or enterprise project, then you will definitely need 16 GB RAM to manage including your non-coding activities