Comments (3)
Hi @KarelWintersky 👋
Depending on your situation, you should use either set()
or add()
:
$dot->set([
'A.E.X' => 5,
'A.E.Y' => 6,
'A.F' => 7
]);
$dot->add([
'A.E.X' => 5,
'A.E.Y' => 6,
'A.F' => 7
]);
There are multiple ways to manipulate the content of the collection; please have a look at the documentation, and the test suite also has great examples.
from php-dot-notation.
It's not always possible declare collection as:
$dot->set([
'A.E.X' => 5,
'A.E.Y' => 6,
'A.F' => 7
]);
much more often the collection is declared "piece by piece":
$dot->add('A.F', 7);
// later
$dot->add('A', [ 'E.Y' => 6 ] );
// and so on..
from php-dot-notation.
It's not always possible declare collection as:
Yes, I totally get what you're saying, but over 150 libraries/apps depend on this package, and your suggestion would be a breaking change. I'll consider this in future major releases if more users would like to have this.
Appreciate your input 👍
from php-dot-notation.
Related Issues (16)
- Cannot access key HOT 5
- array unflatten HOT 2
- How to access element of array HOT 2
- Indirect modification of overloaded element of Adbar\Dot has no effect HOT 1
- php 8.1 deprecations HOT 1
- Question: Wildcards HOT 1
- Deprecation Notice? Adbar\Dot should either be compatible with ArrayAccess HOT 2
- Deprecated error with php8 HOT 5
- Configurable Separator HOT 7
- Parsing empty array all() returns null HOT 1
- Set method does not split key with dot HOT 3
- Add ability to filter results by value e.g $comedies = $dot->get('movies[genre=comedy]'); HOT 2
- Replace (more specifically replace recursive) HOT 2
- Add __set_state() for var_export() support HOT 1
- Add ability to parse arrays containing objects HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from php-dot-notation.