Code:
if ( $_GET['tab'] == 'newest' ) {
// Go through each question
foreach( array_reverse( $end_array, true ) as $tags_and_Qid['question_id'] => $titles_and_Qid['title'] )
{
// Grab the title for the first array
$title = $titles [ $tags_and_Qid['question_id'] ] ['title'];
// Grab the tags for the question from the second array
$tags = $end_array [ $tags_and_Qid['question_id'] ] ['tag'];
// Grab the username for the question from the second array
$username = $usernames [ $tags_and_Qid['question_id'] ] ['username'];
--- cut ----
}
}
Ben genellikle bu kodu kullanmanız gerekir. Tek fark, ilk örnekte array_reverse (..., true)
olduğunu.
Ben bir işlev organize_question
, bu sorunu çözmek için yaparak sorunu çözmeye çalıştık. Ben başarısız oldu:
function organize_questions ( $tab ) {
if ( $_GET['tab'] == 'newest' ) {
echo ( "array_reverse ( $end_array , true )" );
// Problem here!
}
if ( $_GET['tab'] == 'oldest' ) {
echo ( "$end_array" );
// this does not work
} else {
echo ( "array_reverse ( $end_array , true )" );
// Problem here!
}
}
Ben o zaman bu benim kod ilgili çizgi değişti:
foreach( organize_question( $tab ) as $tags_and_Qid['question_id'] => $titles_and_Qid['title'] )
The problem is in transferring variables from one function to another.
I tried to put all necessary variables in the parameters of the function, but everything gets broken, since there are many dependencies on this function.
Ben PHP için yeni duyuyorum bu yüzden ben ne çalışıyorum daha bunu yapmak için daha kolay bir yolu olmalı.