Hello,
We name variables in Moodle by concatenating words together, e.g. $loggingquery, this is well documented. I have run a simple grep search on Moodle core code and found nearly 2k variable names that do not follow that convention and use underscore to separate words. Of course, we should not have core code not adhering to the standards we've set ourselves but maybe it's a good time to review that standard? Have a look at few examples of variable names we have now, and how will they look like if we rename them:
$used_for_db_sessions -> $usedfordbsessions
$fix_sql_params_i -> $fixsqlparamsi
$node_course_modules_quiz_question_instances -> $nodecoursemodulesquizquestioninstances
$node_course_question_categories_question_answer -> $nodecoursequestioncategoriesquestioncategory
It doesn't seem very readable but we have few "monsters" like this, e.g. $inorequaluniqueindex, $submissiongroupmemberswhoneedtosubmit, $origgradeincludescalesinaggregation .
I suggest that we either:
1. Change coding style.
2. Rename the variables to match existing coding style.
cheers,
Tomek
btw. here are the top 20 offenders with number of times they are used in the code:
1050 $grade_item
550 $xmldb_table
351 $xmldb_field
341 $grade_category
210 $grade_grade
152 $default_values
147 $mnet_peer
127 $file_record
110 $grade_items
106 $xmldb_key
85 $replace_values
80 $row_offset
74 $find_tags
72 $xls_formats
70 $photo_id
68 $home_url
66 $xmldb_length
65 $grade_grades
64 $question_identifier
64 $feedback_identifier