Comments (6)
I started writing a replacement for array_splice():
/**
* replacement for broken array_splice() in PHP 7
* https://bugs.php.net/bug.php?id=70471
*
* @param array $input (reference)
* @param integer $offset
* @param integer $length
* @param array $replacement ()
*/
function array_splice_fixed(array &$input, $offset, $length=null, array $replacement=array()) {
if ($offset < 0) {
$left = array_slice($input, $offset);
} else {
$left = array_slice($input, 0, $offset);
}
if (is_null($length)) {
$input = array_merge($left, $replacement);
} elseif ($length < 0) {
$input = array_merge($left, $replacement, array_slice($input, $length));
} else {
$input = array_merge($left, $replacement, array_slice($input, $offset + $length));
}
for ( $i = 0; $i <= count($replacement); $i++ ) {
next($input);
}
}
It works in my test script, but not in phptidy so far.
from phptidy.
Any chance to simulate the PHP 5 behavior with a custom function?
I really miss this on PHP 7 :(
from phptidy.
Can you please test a little bit, before I make the release?
from phptidy.
No problems so far, I tried it in several different projects.
You may also create a 2.18-beta1
or 2.18-rc1
tag first, this would make it much easier to test the newer version (instead of dev-master)
from phptidy.
Thank you very much for testing!
And yes, next time when I ask for testing, I'll make a tag for it. Thanks for the suggestion.
from phptidy.
Good decision to make a 3.0!
from phptidy.
Related Issues (17)
- Detect/handle callback functions
- Can I reindent code with phptidy? HOT 1
- Add some way to extend phptidy. HOT 1
- Create a new release
- The each() function is deprecated
- Please make a new release with latest fixes HOT 1
- replace using wildcards not working HOT 7
- optional default package & indent switch_case like in psr style HOT 1
- use break instead of continue in switch HOT 4
- Html indent HOT 1
- indent_curly_brace_open.php not reformatted HOT 5
- Undefined index error HOT 2
- create composer package HOT 10
- 2 blank lines are added after functions even if $add_blank_lines is set to false in config HOT 2
- Feature Request: A new config to control the space around ! operator HOT 2
- How to use <?= and <?php 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 phptidy.