Tag: PHP

  • Recommended way to access session in Laravel Views

    I noticed Session::get(‘error’) in a Laravel view file. Using classes directly in the view is not a good practice. So, I asked Lary to confirm. Q: Is accessing sessions in Laravel views with Session::get(‘error’) good or is there any better way? Lary: In Laravel, accessing the session in views using Session::get(‘error’) is a valid approach. However, Laravel provides…

  • Bad programming due to lack of basic knowledge

    Even though I have 15 years of experience as a full-stack developer, I make mistakes. Sometimes, silly mistakes. I am good at solving problems and providing solutions to complex business requirements. But I don’t know everything, even some basic things. Recently, my client asked me to add a feature to attach a file to the…

  • When comparing two arrays (in PHP), what is the difference between == and === ?

    Wish happy independence day to all Indians. I have not posted anything since a long time. I thought to break the silence with this small post. I was appearing for a skill test in Advanced PHP. I scored 82% (though I was expecting to get 90%), but I am upset as the percentile is just…

  • Playing with Switches

    While coding, you need to control over something, so we have “Control Structures” in our language. Most of the programing language have control structures. And you are building an application, so you (not you exactly, your code) need to make a decision, then your code start comparing things and take the correct decision and moves…