Skip to main content
Code Review

Return to Question

replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

I recently create a function to combine some arrays of associative arrays in a single array in response to a stackoverflow question stackoverflow question, where you can found more details about this.

I recently create a function to combine some arrays of associative arrays in a single array in response to a stackoverflow question, where you can found more details about this.

I recently create a function to combine some arrays of associative arrays in a single array in response to a stackoverflow question, where you can found more details about this.

added 12 characters in body
Source Link
Phrancis
  • 20.5k
  • 6
  • 69
  • 155
  1. [0=>['title1'=>'Title 1'], 1=>['title2'=>'Title 2']];[0=>['title1'=>'Title 1'], 1=>['title2'=>'Title 2']];
  1. [0=>['contn1'=>'Content 1'],1=>['contn2'=>'Content 2']];[0=>['contn1'=>'Content 1'],1=>['contn2'=>'Content 2']];

[[

0=>['title1'=>'Title 1','contn1'=>'Content 1'],0=>['title1'=>'Title 1','contn1'=>'Content 1'],

1=>['title2'=>'Title 2','contn2'=>'Content 2']1=>['title2'=>'Title 2','contn2'=>'Content 2']

]]

  1. [0=>['title1'=>'Title 1'], 1=>['title2'=>'Title 2']];
  1. [0=>['contn1'=>'Content 1'],1=>['contn2'=>'Content 2']];

[

0=>['title1'=>'Title 1','contn1'=>'Content 1'],

1=>['title2'=>'Title 2','contn2'=>'Content 2']

]

  1. [0=>['title1'=>'Title 1'], 1=>['title2'=>'Title 2']];
  1. [0=>['contn1'=>'Content 1'],1=>['contn2'=>'Content 2']];

[

0=>['title1'=>'Title 1','contn1'=>'Content 1'],

1=>['title2'=>'Title 2','contn2'=>'Content 2']

]

Bumped by Community user
Bumped by Community user
Bumped by Community user
improved formatting, added detailed description
Source Link
fusion3k
  • 151
  • 1
  • 1
  • 6

The function works as expected, but I think their description is very obscure. In addition, i choose constant T_OBJECT_CAST as option to convert each rows as object: someone can suggest a bestbetter predefined constants?

First of all (in the latest update), I check if the last argument is the predefined constant T_OBJECT_CAST: if it is, I set $asObject to True, then I pop-it off the end of arguments array; now in the $args variable I have an array with each passed arrays.

The function works as expected, but I think their description is very obscure. In addition, i choose constant T_OBJECT_CAST as option to convert each rows as object: someone can suggest a best predefined constants?

First of all (in the latest update), I check if the last argument is the predefined constant T_OBJECT_CAST: if it is, I set $asObject to True, then I pop-it off the end of arguments array; now in the $args variable I have an array with each passed arrays.

The function works as expected, but I think their description is very obscure. In addition, i choose constant T_OBJECT_CAST as option to convert each rows as object: someone can suggest a better predefined constants?

First of all, I check if the last argument is the predefined constant T_OBJECT_CAST: if it is, I set $asObject to True, then I pop-it off the end of arguments array; now in the $args variable I have an array with each passed arrays.

improved formatting, added detailed description
Source Link
fusion3k
  • 151
  • 1
  • 1
  • 6
Loading
Slightly improved the formatting + added tag
Source Link
Loading
Source Link
fusion3k
  • 151
  • 1
  • 1
  • 6
Loading
lang-php

AltStyle によって変換されたページ (->オリジナル) /