PHP 7 - Constant Arrays
Array constants can now be defined using the define() function. In PHP 5.6, they could only be defined using const keyword.
يمكن الآن تعريف ثوابت المصفوفة باستخدام وظيفة تعريف (). في PHP 5.6 ، يمكن تعريفهم فقط باستخدام كلمة أساسية ثابتة.
Example
<?php //define a array using define function define('animals', [ 'dog', 'cat', 'bird' ]); print(animals[1]); ?>
It produces the following browser output −
cat
تعليقات
إرسال تعليق