Giter VIP home page Giter VIP logo

Comments (5)

kukawski avatar kukawski commented on May 22, 2024

It throws an error. Only built-in typeof operator handles checks for non-existing variables in JavaScript, so the empty() function in phpjs has a limitation, which cannot be handled. In fact, the isset and empty in PHP are not real functions, they are language constructs, that look similar to functions, but have often "greater powers".

from locutus.

Freyskeyd avatar Freyskeyd commented on May 22, 2024

Rofl,

too bad.. I'm tired to use typeof blabla =='undefined' blabla

too long when i've 300000 test vars...

from locutus.

kukawski avatar kukawski commented on May 22, 2024

Well, PHP and JavaScript differ in many ways, so not everything can be ported from one to another. In PHP for instance there is no explicit variable declaration, so the isset/empty make sense. In JavaScript using undeclared variables leads to many problems, so you should just avoid such practices.

from locutus.

Freyskeyd avatar Freyskeyd commented on May 22, 2024

yep but when i try to access to an object parameter in my view and when the object is undefined. i must try the object first, next the params...etc

it's little complicated for nothing.

from locutus.

kvz avatar kvz commented on May 22, 2024

Not something we'll fix anyway, sorry.

from locutus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.