2
문제는 ...이처럼다음에 그것을
기존의 배열 :
Array(
[0] => array('sample 1', 'sample 2')
[1] => array('cat', 'dog')
)
또 다른 배열 : I가 발생하는 것이
Array(
[0] => array('sample 3', 'sample 4')
)
0 키 옆에 추가하면 다음과 같이됩니다.
Array(
[0] => array('sample 1', 'sample 2')
[1] => array('sample 3', 'sample 4')
[2] => array('cat', 'dog')
)
어떻게 할 수 있습니까?
다음Array(
[0] => sample 1
[1] => sample 2
[2] => sample 3
[3] => sample 4
[4] => cat
[6] => dog
)
내 현재의 현재의 코드
$new_post_order = array();
foreach($the_query['posts'] as $the_post) {
$portfolio_reorder = '';
$portfolio_reorder = get_post_meta($the_post['ID'], 'portfolio_reorder', true); // Get the order on the db
if(empty($portfolio_reorder)) { // If its empty...
$portfolio_reorder = 0; // Add default order
}
array_splice($new_post_order, $portfolio_reorder, 0, $the_post);
}
echo '<pre>';
print_r($new_post_order);
echo '</pre>';
Maxhud 내 질문을 편집했습니다. 내 발췌 부분을 잘 보살펴주세요. 감사! – Ian
은 귀하의 예에서 언급 한 '샘플'에 해당하는 $ the_post입니까? 의미, $ the_post 변수 저장소는 무엇입니까? 두 개의 항목 또는 문자열이있는 배열입니까? – maxhud
$ the_post 변수는 배열입니다. – Ian