I found this piece of code in the Phoronix Test Suite:
$os_packages_to_install = explode(' ', implode(' ', $os_packages_to_install));
I've seen it before and I don't see it's point. What does it do?
It will return an array but the difference with $os_packages_to_install
is that if a value of $os_packages_to_install
contains a space, it will also be splitted.
so:
["hjk jklj","jmmj","hl mh","hlm"]
implode gives:
"hjk jklj jmmj hl mh hlm
explode again will give:
["hjk","jklj","jmmj","hl","mh","hlm"]
A google search of the line came up with this:
Rebuild the array index since some OS package XML tags provide multiple package names in a single string
Basically, it's because the original array might look like this:
$os_packages_to_install = array(
'package1',
'package2 package3'
);
When it needs to look like this:
$os_packages_to_install = array(
'package1',
'package2',
'package3'
);
Source: http://www.phorogit.com/index.php?p=phoronix-test-suite.git&dl=plain&h=7c5f0c0cf91dc61c1f220b0871040d4441836436.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With