The Rise of AI: Unleashing the Power of Artificial Intelligence


Artificial Intelligence (AI) has emerged as a transformative force, revolutionizing industries and reshaping our world. With its exponential growth and advancements, AI has become an integral part of our daily lives, from voice assistants and personalized recommendations to autonomous vehicles and smart cities. In this article, we explore the remarkable rise of AI, its impact on various sectors, and the future possibilities it holds.

Defining AI

Artificial Intelligence refers to the development of computer systems capable of performing tasks that typically require human intelligence. It encompasses a range of technologies, including machine learning, natural language processing, computer vision, and robotics. By analyzing vast amounts of data and learning from patterns, AI systems can make predictions, recognize patterns, and automate complex tasks.

AI in Everyday Life

AI has seamlessly integrated into our daily routines, enhancing our experiences and simplifying tasks. Voice assistants like Siri and Alexa have become household companions, responding to our queries and executing commands. AI algorithms power personalized recommendations on streaming platforms, e-commerce websites, and social media, helping us discover relevant content. Moreover, AI has made its way into healthcare, finance, transportation, and entertainment, augmenting efficiency and decision-making processes.

AI in Industries

a. Healthcare: AI has the potential to revolutionize healthcare by analyzing medical data, diagnosing diseases, and assisting in treatment decisions. It can detect patterns in patient data, predict disease outcomes, and optimize medication regimens. AI-powered robots can also assist in surgeries, reducing human error and improving precision.

b. Finance: The financial industry has embraced AI for fraud detection, algorithmic trading, and risk assessment. AI algorithms can analyze vast amounts of financial data in real-time, identifying anomalies and suspicious patterns. This technology enables quicker, more accurate decision-making and helps prevent fraudulent activities.

c. Transportation: AI is reshaping the transportation sector with autonomous vehicles. Self-driving cars powered by AI algorithms can navigate roads, recognize obstacles, and make real-time decisions. This technology has the potential to reduce accidents, optimize traffic flow, and provide more efficient transportation solutions.

d. Manufacturing: AI-driven automation has transformed the manufacturing industry, improving productivity and reducing costs. Robots equipped with AI capabilities can perform repetitive tasks with precision and efficiency. AI systems can also optimize supply chain management, predicting demand patterns and streamlining inventory management.

Ethical Considerations

As AI becomes more pervasive, it raises ethical concerns that need careful attention. Issues like bias in algorithms, privacy invasion, and job displacement need to be addressed. Developers and policymakers must ensure transparency, accountability, and fairness in AI systems. Regulation frameworks should be in place to protect individuals’ rights and prevent misuse of AI technologies.

The Future of AI

The future of AI holds immense potential. As technology continues to advance, AI systems will become more sophisticated, capable of understanding complex human emotions, reasoning, and creativity. We can expect AI to play a significant role in solving grand challenges like climate change, healthcare accessibility, and sustainable development. Collaboration between humans and AI will enable breakthrough innovations, making our world smarter and more efficient.


The rise of AI has been nothing short of transformative. From its integration into our everyday lives to revolutionizing industries, AI has showcased its capabilities in various domains. As we move forward, it is crucial to harness the power of AI ethically and responsibly, ensuring that its benefits are accessible to all. With continued research, collaboration, and careful consideration of ethical implications, AI will undoubtedly shape a future that is smarter, more efficient, and filled with boundless possibilities.

p/s: This article was generate by ChatGPT

Jomlaunch Edisi Ke-9


JomLaunch merupakan salah satu acara komuniti yang popular dan sering menyaksikan pelbagai produk dan idea baru dilancarkan melaluinya. Pada 04-08 Oktober 2021 telah berlangsung acara Jomlaunch Edisi Ke-9 yang dianjurkan oleh komuniti Facebook Group JOMWEB. Melalui acara ini, programmers, developers, UI/UX designers, pakar security, dan lain-lain penggiat ICT tanah air berhimpun untuk mengetengahkan projek-projek mereka. Ini semua bagi meraikan bakat dan kepakaran ICT tanah air, dan mengambil peluang untuk kenal mengenali dan belajar daripada satu sama lain.

Seperti edisi sebelum ini, penganjuran Jomlaunch Edisi Ke-9 juga diadakan negara masih lagi berada dalam era pandemik COVID-19. Untuk itu Jomlaunch Edisi Ke-9 diteruskan lagi secara digital melalui aplikasi Airmeet.

Format Acara Jomlaunch Edisi Ke-9

Untuk sesi kali ini, Jomlaunch telah merancang untuk mempelbagaikan aktiviti bagi memeriahkan acara yang diadakan. Bermula dengan sesi pagi iaitu perkongsian  daripada projek terpilih untuk membentangkan projek mereka kepada umum. Kemudian sesi perkongsian ilmu teknikal dan bisnes startup dan ICT daripada pakar dan mereka yang berpengalaman dari dalam dan luar negara pada sebelah petang dan malamnya. Tidak lupa juga sesi networking untuk memberi peluang kepada peserta untuk berkongsi diskusi mengenali co-founder bisnes, klien, kenalan dan pelbagai lagi.

Seperti edisi yang diadakan sebelum ini, setiap sesi pembentangan projek terpilih akan diakhiri dengan soalan kuiz kepada peserta dan merebut hadiah menarik yang ditawarkan. Istimewa pada edisi kali ini, pencarian telur emas (Gold Egg) diperkenalkan bagi membolehkan peserta menambah mata QR Code yang juga melayakkan peserta menerima kategori hadiah istimewa.

Projek-projek Yang Dibentangkan

Jomlaunch Edisi Ke-9 2021 kali ini telah menampilkan kategori baru iaitu untuk penuntut ICT membentangkan projek-projek mereka. Kategori penuntut ICT ini ditaja oleh RunCloud. Setiap kali penganjuran Jomlaunch diadakan, pasti akan ada projek-projek yang mempunyai nilai dan impak yang besar.

Antara projek-projek yang dibentangkan sepanjang 5 hari acara ini diadakan ialah:

  1. SecurePay oleh Amir Haris – SecurePay is the official payment platform for Jomlaunch which using security feature (ISO/IEC 15408)
  2. Workbeat oleh Samantha Liew – An establish digitalized HR Management which using PHP, CakePHP and jQuery in the development
  3. eKV oleh Muhammad Hanis Irfan – A centralized system for Kolej Vokasional student. Invented to ease the access for Lecturers and Student, and integrating the different features into one easy access portal
  4. TutorXcess oleh Ziyad Rashid – A one stop solution for Tutor and Class booking. This will simplify the process in choosing tutors based on user’s preferences. It is also a platform for tutors to promote their class and teaching expertise
  5. EasyDrop oleh Siti Nabilah – A system that applied a contactless delivery approach for users. No more hassle in receiving the parcel ie: waiting for delivery. Just drop the parcel into Easy Drop and there will be tracking by SMS platform
  6. Planet Mahir oleh Ferdy Fauzi – platform perkongsian kemahiran dalam talian berbentuk Video On Demand (VOD) pertama di dunia yang menggunakan Bahasa Melayu dalam penyampaian di mana ia boleh diakses melalui laman web dan aplikasi mudah alih
  7. IBEDS oleh Dr. Alia Nadhirah – Integrated Bed Entry and Database System
  8. GetOTP oleh Fathur Rahman – With just a simple API call, you can implement your one time password authentication flow without worrying about retry or multiple authentication channel logic
  9. BDxAcademy oleh Khairul Fikri – Membantu pelajar untuk membina projek dan mendalami penggunaan Arduino dan Raspberry Pi
  10. AIRDrone oleh Said Zalehan Said Johan – The drone that powered by an autonomous system by using Python language. The drone build from manual control to the drone that control by itself
  11. C-HAT oleh Raja Hafiz – A¬†mobile application for Ampang Hospital services, where their tagline is “Do not come to the hospital”
  12. ToyyibGold oleh Nurina Amira Mohd Isham РA platform to provide online physical gold trading opportunities
  13. Juno oleh Ariff Azraai – Open source intelligence data hub. Help people to analyze current affairs
  14. Stafy oleh Erymuzuan РA Human Resource Management System for SMEs and SMEs that is almost free to use
  15. Dynanity oleh Said Nizamuddin Nadim – eunification Literacy For Dynamic Evaluation With Artificial Intelligence project, a student final year project (FYP) organizing and judging system
  16. PetotumVET oleh Shifa Azahar РA management system for veterinary clinics
  17. Playlab Classroom oleh Ridzwan Azhar – An interactive gamification learning platform for kids (3 – 7 years old)
  18. Lapasar Wholesale oleh Farhan Syah – Lapasar Wholesale aims to improve the supply chain process of SMEs mainly in the Restaurant and Groceries by providing a platform to buy supplies and on-demand supply logistic
  19. Teamfantasia oleh Shahrir Bahar – The Malaysia Super League (Liga Super Malaysia) is the men’s top professional football division of the Malaysia football league system
  20. KUIS E-Voting System oleh Luqman Haqeem – KUIS E-Voting System project
  21. Parkir Pintar Kecerdasan Buatan oleh Hamizi Jaminan – Artificial Intelligence Smart Parking project, which is an intelligent parking management system (using AI)
  22. Open Petro oleh Muhammad Farhan Helmy – Petrol Station Automation System with IoT Pump
  23. TropikaAG oleh Farid Jasni РDemocratizing AI, machine learning and tech to every farmers. A garden management system built using .Net
  24. Basetribes oleh Ramzan Rozali – WordPress CRM plugin that help to identify your top 20 customers and make them repeat orders by contacting them via whatsapp
  25. Stencil oleh Shulhi Sapli – Stencil is an image generation API that automatically creates share images for your content from custom templates

Seperti edit sebelum ini, sesi pembentangan Jomlaunch Asia Conference edisi ke-9 ini juga tidak kurang menariknya oleh speaker-speaker jemputan berikut:

  1.  Build your High Concurrency App with PHP and Swoole oleh Albert Chen -How to build high concurrency app with PHP and Swoole? A coroutine-based asynchronous PHP programming framework
  2. StoreApp – One Platform, Multiple Ways To Sell oleh Tan Yin See – A comprehensive app that aims to make the store management experience easier and efficient for consumers
  3. The Freelancer’s Guide to Building a Sustainable Digital Business oleh Nathan Onn – Sharing about the freelance framework ‘One Coder Agency: The Freelancer’s Guide to Building a Sustainable Digital Business’
  4. Hyper Freelance oleh Ben Issen – Discovered more on the bright side of freelancing. Also introduced the Hyper Freelance model that consist of three activities: freelancing, teaching and product building
  5. Let it Crash! An approach on Building Reliable Services oleh Hatta Zainal – Sharing the ‘Let it Crash’ concept using Erlang technology and how the approach can be used in app development
  6. NFT’s Future Potential oleh Irsyad Saidin – NFT’s Future Potential from a variety of technology such as Smart Contract, Solidity, including the use cases, and much more
  7. Fundamentals of Application Performance Tuning oleh Radzi Tajuddin – A sharing session about the ‘Fundamentals of Application Tuning’
  8. How to Build an Audience-Driven Business oleh Arvid Kahl – The Bootstrap Founder sharing the business ideas generation which derive from the audience perspective

Pada sesi sebelah malam, perkongsian yang hebat daripada pembentang-pembentang berikut:

  1. Kisah Bermulanya Noor App – Izzairi Yamin – Some helpful hacks for developer and tips for startup, apart from the development journey of The Noor App
  2. Digital Marketing oleh Syahmi Sadan – How to market the products through three structures of FB Ads which are Campaign, Ad Set and Ad?
  3. How to DIY Your Dream Career? oleh Safinah Mohd Zin – How to figure out either my salary is reasonable with my position and skillset? How to DIY my resume with the right content?
  4. DevOps: Pengaruhnya Kepada Pengurusan Projek oleh Harisfazillah Jamel dan Fazli Azran – What is the role of DevOps in project management? Who is responsible in DevOps? How to adopt DevOps in project management?
  5. Kisah Bermulanya Baituljannah oleh Muhammad Azrain – One of the main Jomlaunch 2021 supporters. A digital matchmaking platform for Muslims which launched in March 2018. How does Baituljannah come into the picture in the first place?

Pandangan peribadi saya, penganjuran Jomlaunch Edisi Ke-9 kali ini telah mencapai sasarannya kerana tempoh 5 hari yang dirancang telah diisi dengan penuh perkongsian ilmu dan teknologi ICT daripada pembentang-pembentang yang hebat dan telah mempunyai nama dalam industri ICT di Malaysia khususnya. Ucapan terima kasih saya kepada tuan Diktator Dino Iszuddin yang telah bertungkus lumus bersama pasukkan bagi menjayakan program ini. Dan tidak lupa juga kepada semua sponsor serta mereka yang terlibat secara langsung atau tidak langsung dalam acara sebegini.

Harapan saya agar acara sebegini diteruskan lagi pada masa-masa akan datang dengan menjemput mana-mana VVIP yang dalam bidang berkaitan agar program seperti ini mendapat perhatian pihak yang lebih sewajarnya untuk mengangkat industri ICT tanah air dengan menggunakan kemampuan dan kepakaran anak Malaysia.

PHP 7.4 Upgrade Notes

PHP 7.4 Upgrade Notes

1. Backward Incompatible Changes
2. New Features
3. Changes in SAPI modules
4. Deprecated Functionality
5. Changed Functions
6. New Functions
7. New Classes and Interfaces
8. Removed Extensions and SAPIs
9. Other Changes to Extensions
10. New Global Constants
11. Changes to INI File Handling
12. Windows Support
13. Migration to pkg-config
14. Other Changes
15. Performance Improvements

1. Backward Incompatible Changes

– Core:
. Trying to use values of type null, bool, int, float or resource as an
array (such as $null[“key”]) will now generate a notice. This does not
affect array accesses performed by list().
. get_declared_classes() no longer returns anonymous classes that haven’t
been instantiated yet.
. “fn” is now a reserved keyword. In particular it can no longer be used as a
function or class name. It can still be used as a method or class constant
. Passing the result of a (non-reference) list() assignment by reference is
consistently disallowed now. Previously this worked if the right hand side
was a simple (CV) variable and did not occur as part of the list().
. `<?php` at the end of the file (without trailing newline) will now be
interpreted as an opening PHP tag. Previously it was interpreted either as
`<? php` and resulted in a syntax error (with short_open_tag=1) or was
interpreted as a literal `<?php` string (with short_open_tag=0).
. When using include/require on a stream, stream_set_option() will be invoked
with the STREAM_OPTION_READ_BUFFER option. Custom stream wrapper
implementations may need to implement the stream_set_option() method to
avoid a warning (always returning false is a sufficient implementation).

– BCMath:
. BCMath functions will now warn if a non well-formed number is passed, such
as “32foo”. The argument will be interpreted as zero (as before).

– Curl:
. Attempting to serialize a CURLFile class will now generate an exception.
Previously the exception was only thrown on unserialization.
. Using CURLPIPE_HTTP1 is deprecated, and is no longer supported as of cURL
. The $version parameter of curl_version() is deprecated. If any value not
equal to the default CURLVERSION_NOW is passed, a warning is raised and the
parameter is ignored.

– Date:
. Calling var_dump() or similar on a DateTime(Immutable) instance will no
longer leave behind accessible properties on the object.
. Comparison of DateInterval objects (using ==, < and so on) will now generate
a warning and always return false. Previously all DateInterval objects were
considered equal, unless they had properties.

– Intl:
. The default parameter value of idn_to_ascii() and idn_to_utf8() is now
INTL_IDNA_VARIANT_UTS46 instead of the deprecated INTL_IDNA_VARIANT_2003.

– MySQLi:
. The embedded server functionality has been removed. It was broken since
at least PHP 7.0.
. The undocumented mysqli::$stat property has been removed in favor of

– Openssl:
. The openssl_random_pseudo_bytes() function will now throw an exception in
error situations, similar to random_bytes(). In particular, an Error is
thrown if the number of requested bytes is less than *or equal to* zero,
and an Exception is thrown if sufficient randomness cannot be gathered.
The $crypto_strong output argument is guaranteed to always be true if the
function does not throw, so explicitly checking it is not necessary.

. When PREG_UNMATCHED_AS_NULL mode is used, trailing unmatched capturing
groups will now also be set to null (or [null, -1] if offset capture is
enabled). This means that the size of the $matches will always be the same.

. Installation of PEAR (including PECL) is no longer enabled by default. It
can be explicitly enabled using –with-pear. This option is deprecated and
may be removed in the future.

– PDO:
. Attempting to serialize a PDO or PDOStatement instance will now generate
an Exception rather than a PDOException, consistent with other internal
classes which do not support serialization.

– Reflection:
. Reflection objects will now generate an exception if an attempt is made
to serialize them. Serialization for reflection objects was never
supported and resulted in corrupted reflection objects. It has been
explicitly prohibited now.

– SPL:
. Calling get_object_vars() on an ArrayObject instance will now always return
the properties of the ArrayObject itself (or a subclass). Previously it
returned the values of the wrapped array/object unless the STD_PROP_LIST
flag was specified. Other affected operations are:

* ReflectionObject::getProperties()
* reset(), current(), etc. Use Iterator methods instead.
* Potentially others working on object properties as a list.

(array) casts are *not* affected. They will continue to return either the
wrapped array, or the ArrayObject properties, depending on whether the
STD_PROP_LIST flag is used.
. SplPriorityQueue::setExtractFlags() will throw an exception if zero is
passed. Previously this would generate a recoverable fatal error on the
next extraction operation.
. ArrayObject, ArrayIterator, SplDoublyLinkedList and SplObjectStorage now
support the __serialize() + __unserialize() mechanism in addition to the
Serializable interface. This means that serialization payloads created on
older PHP versions can still be unserialized, but new payloads created by
PHP 7.4 will not be understood by older versions.

– Standard:
. The “o” serialization format has been removed. As it is never produced by
PHP, this may only break unserialization of manually crafted strings.
. Password hashing algorithm identifiers are now nullable strings rather
than integers.

* PASSWORD_DEFAULT was int 1; now is null
* PASSWORD_BCRYPT was int 1; now is string ‘2y’
* PASSWORD_ARGON2I was int 2; now is string ‘argon2i’
* PASSWORD_ARGON2ID was int 3; now is string ‘argon2id’

Applications correctly using the constants PASSWORD_DEFAULT,
function correctly.
. htmlentities() will now throw a notice (instead of a strict standards
warning) if it is used with an encoding for which only basic entity
substitution is supported, in which case it is equivalent to
. fread() and fwrite() will now return false if the operation failed.
Previously an empty string or 0 was returned. EAGAIN/EWOULDBLOCK are not
considered failures.
. fread() and fwrite() on plain files will now throw a notice on failure,
such as when trying to write to a read-only file resource.

– Tokenizer:
. token_get_all() will now emit a T_BAD_CHARACTER token for unexpected
characters instead of leaving behind holes in the token stream.

2. New Features

– Core:
. Added support for typed properties. For example:

class User {
public int $id;
public string $name;

This will enforce that $user->id can only be assigned integers and
$user->name can only be assigned strings. For more information see the

. Added support for arrow functions with implicit by-value scope binding.
For example:

$factor = 10;
$nums = array_map(fn($num) => $num * $factor, $nums);


. Added support for limited return type covariance and argument type
contravariance. The following code will now work:

class A {}
class B extends A {}

class Producer {
public function method(): A {}
class ChildProducer extends Producer {
public function method(): B {}

Full variance support is only available if autoloading is used. Inside a
single file only non-cyclic type references are possible, because all
classes need to be available before they are referenced.

. Added support for coalesce assign (??=) operator. For example:

$array[‘key’] ??= computeDefault();
// is roughly equivalent to
if (!isset($array[‘key’])) {
$array[‘key’] = computeDefault();


. Added support for unpacking inside arrays. For example:

$arr1 = [3, 4];
$arr2 = [1, 2, …$arr1, 5];
// $arr2 == [1, 2, 3, 4, 5]


. Added support for underscore separators in numeric literals. Some examples:

6.674_083e-11; // float
299_792_458; // decimal
0xCAFE_F00D; // hexadecimal
0b0101_1111; // binary


. Support for WeakReferences has been added.

. Throwing exceptions from __toString() is now permitted. Previously this
resulted in a fatal error. Existing recoverable fatals in string conversions
have been converted to Error exceptions.

. CURLFile now supports stream wrappers in addition to plain file names, if
the extension has been built against libcurl >= 7.56.0. The streams may
need to be seekable.

– Filter:
. The FILTER_VALIDATE_FLOAT filter now supports the min_range and max_range
options, with the same semantics as FILTER_VALIDATE_INT.

– FFI:
. A new extension which provides a simple way to call native functions, access
native variables and create/access data structures defined in C libraries.

– GD:
. Added the “scatter” image filter (IMG_FILTER_SCATTER) to apply a scatter
filter to images. This filter has the following prototype:

imagefilter($im, IMG_FILTER_SCATTER, int $sub, int $plus, array $colors = []);

The $colors array can be populated with a set of indexed colors to
apply the scatter pixel shifting on.

Note, the result of this filter is always random.

– Hash:
. Added “crc32c” hash using Castagnoli’s polynomial. This crc32 variant is
used by storage systems, such as iSCSI, SCTP, Btrfs and ext4.

– Mbstring:
. Added mb_str_split() function, which provides the same functionality as
str_split(), but operating on code points rather than bytes.

– OPcache:
. Support for preloading code has been added.

. The preg_replace_callback() and preg_replace_callback_array() functions now
accept an additional $flags argument, with support for the
format of the matches array passed to to the callback function.

– PDO:
. The username and password can now be specified as part of the PDO DSN for
the mysql, mssql, sybase, dblib, firebird and oci drivers. Previously this
was only supported by the pgsql driver. If a username/password is specified
both in the constructor and the DSN, the constructor takes precedence.

new PDO(“mysql:host=xxx;port=xxx;dbname=xxx;user=xxx;password=xxx”);

. PDOStatement::getColumnMeta() is now available

– PDO_SQLite:
. PDOStatement::getAttribute(PDO::SQLITE_ATTR_READONLY_STATEMENT) allows
checking whether the statement is read-only, i.e. if it doesn’t modify
the database.
. PDO::setAttribute(PDO::SQLITE_ATTR_EXTENDED_RESULT_CODES, true) enables the
use of SQLite3 extended result codes in errorInfo().

– SQLite3:
. Added SQLite3::lastExtendedErrorCode() to fetch the last extended result
. Added SQLite3::enableExtendedResultCodes($enable = true), which will make
SQLite3::lastErrorCode() return extended result codes.

– Standard:
. strip_tags() now also accepts an array of allowed tags: Instead of
strip_tags($str, ‘<a><p>’) you can now write strip_tags($str, [‘a’, ‘p’]).

. A new mechanism for custom object serialization has been added, which
uses two new magic methods:

// Returns array containing all the necessary state of the object.
public function __serialize(): array;

// Restores the object state from the given data array.
public function __unserialize(array $data): void;

The new serialization mechanism supersedes the Serializable interface,
which will be deprecated in the future.


. array_merge() and array_merge_recursive() may now be called without any
arguments, in which case they will return an empty array. This is useful
in conjunction with the spread operator, e.g. array_merge(…$arrays).

. proc_open() now accepts an array instead of a string for the command. In
this case the process will be opened directly (without going through a
shell) and PHP will take care of any necessary argument escaping.

proc_open([‘php’, ‘-r’, ‘echo “Hello World\n”;’], $descriptors, $pipes);

. proc_open() now supports “redirect” and “null” descriptors. For example:

// Like 2>&1 on the shell
proc_open($cmd, [1 => [‘pipe’, ‘w’], 2 => [‘redirect’, 1]], $pipes);
// Like 2>/dev/null or 2>nul on the shell
proc_open($cmd, [1 => [‘pipe’, ‘w’], 2 => [‘null’]], $pipes);

. password_hash() has argon2i(d) implementations from ext/sodium when PHP is
built without libargon.


3. Changes in SAPI modules

4. Deprecated Functionality

– Core:
. Nesting ternary operators without explicit parentheses is deprecated:

// Code like
$a ? $b : $c ? $d : $e
// should be replaced by (current interpretation)
($a ? $b : $c) ? $d : $e
// or (likely intended interpretation)
$a ? $b : ($c ? $d : $e)

. The array and string offset access syntax using curly braces is deprecated.
Use $str[$idx] instead of $str{$idx}.
. The (real) cast is deprecated, use (float) instead.
. Unbinding $this of a non-static method through a combination of
ReflectionMethod::getClosure() and closure rebinding is deprecated. Doing
so is equivalent to calling a non-static method statically, which has been
deprecated since PHP 7.0.
. Unbinding $this of a non-static closure is deprecated.
. Using “parent” inside a class without a parent is deprecated, and will throw
a compile-time error in the future. Currently an error will only be
generated if/when the parent is accessed at run-time.
. The allow_url_include ini directive is deprecated. Enabling it will generate
a deprecation notice at startup.

– COM:
. Importing type libraries with case-insensitive constant registering has been

– Filter:

– Mbstring:
. Passing a non-string pattern to mb_ereg_replace() is deprecated. Currently
non-string patterns are interpreted as ASCII codepoints. In PHP 8 the
pattern will be interpreted as a string instead.
. Passing the encoding as 3rd parameter to mb_strrpos() is deprecated. Instead
pass a 0 offset and encoding as 4th parameter.

. ldap_control_paged_result_response and ldap_control_paged_result are
deprecated. Pagination controls can be sent along with ldap_search instead.

– Reflection:
. Calls to ReflectionType::__toString() now generate a deprecation notice.
This method has been deprecated in favor of ReflectionNamedType::getName()
in the documentation since PHP 7.1, but did not throw a deprecation notice
for technical reasons.
. The export() methods on all Reflection classes are deprecated. Construct a
Reflection object and convert it to string instead:

// ReflectionClass::export(Foo::class, false) is:
echo new ReflectionClass(Foo::class), “\n”;
// $str = ReflectionClass::export(Foo::class, true) is:
$str = (string) new ReflectionClass(Foo::class);

– Standard:
. Passing invalid characters to ”base_convert()”, ”bindec()”, ”octdec()”
and ”hexdec()” will now generate a deprecation notice. The result will
still be computed as if the invalid characters did not exist. Leading and
trailing whitespace, as well as prefixes of type 0x (depending on base)
continue to be allowed.
. Using array_key_exists() on objects is deprecated. Instead either isset()
or property_exists() should be used.
. The is_real() function is deprecated, use is_float() instead.
. The get_magic_quotes_gpc() and get_magic_quotes_runtime() functions are
deprecated. They always return false.
. The hebrevc() function is deprecated. It can be replaced with
nl2br(hebrev($str)), or preferably the use of Unicode RTL support.
. The convert_cyr_string() function is deprecated. It can be replaced by one
of mb_convert_string(), iconv() or UConverter.
. The money_format() function is deprecated. It can be replaced by the
intl NumberFormatter functionality.
. The ezmlm_hash() function is deprecated.
. The restore_include_path() function is deprecated. It can be replaced by
. Passing parameters to implode() in reverse order is deprecated, use
implode($glue, $parts) instead of implode($parts, $glue).

5. Changed Functions

– SPL:
. SplFileObject::fputcsv(), ::fgetcsv() and ::setCsvControl() now accept an
empty string as $escape argument, which disables the proprietary PHP
escaping mechanism. SplFileObject::getCsvControl() now may also return an
empty string for the third array element, accordingly.

– Standard:
. fputcsv() and fgetcsv() now accept an empty string as $escape argument,
which disables the proprietary PHP escaping mechanism. The behavior of
str_getcsv() has been adjusted accordingly (formerly, an empty string was
identical to using the default).
. proc_open() on Windows can be passed a “create_process_group” option. It
is required, if the child process is supposed to handle CTRL events.
. password_hash() now accepts nullable string and int as $algo argument.
. password_needs_rehash() now accepts nullable string and int as $algo

6. New Functions

– Core:
. Added get_mangled_object_vars($object) function, which returns the mangled
object properties. It returns the same result as (array) $object, with the
exception that it ignores overloaded array casts, such as used by

– GD:
. Added imagecreatefromtga() function, which allows reading images in TGA
format. TGA support is now also indicated by gd_info() and imagetypes().
Note that TGA images are not recognized by imagecreatefromstring() and

– OpenSSL:
. Added openssl_x509_verify(mixed cert, mixed key) function that verifies the
signature of the certificate using a public key. A wrapper around the
OpenSSL’s X509_verify() function.
See <>.

– Pcntl:
. Added bool pcntl_unshare(int flags) function which allows dissociating
parts of the process execution context which are currently being shared with
other processes. Explicitly, it allows you to unshare the mount, IPC, UTS,
network, PID, user and cgroup namespaces.

– SQLite3:
. Added SQLite3Stmt::getSQL() to retrieve the SQL of the statement. If true is
passed as $expanded argument, query parameters will be replaced in the
return value by their currently bound value, if libsqlite ‚Č• 3.14 is used.
. Added SQLite3::backup() to create database backups via the SQLite3 online
backup API.

– Standard
. bool sapi_windows_set_ctrl_handler(callable handler, [, bool add = true]) –
set or remove a handler function upon receiving a CTRL event. The handler
function is expected to have this signature: “function handler(int $event)”.
. bool sapi_windows_generate_ctrl_event(int type, int pid) – send a CTRL event
to another process.
. array password_algos() – return a complete list of all registered password
hashing algorithms. For more details see the RFC:

7. New Classes and Interfaces

– Reflection:
. A new ReflectionReference class has been added, which allows detecting
references and comparing them for identity. For more details see the RFC:

8. Removed Extensions and SAPIs

– Interbase:
. The interbase extension has been moved to PECL. Access to an InterBase
and/or FireBird based database is still available with the PDO_Firebird
extension. For more details see the RFC:

– Recode:
. The recode extension has been moved to PECL. For character set/encoding
conversion the iconv or mbstring extensions could be used instead.

. The WDDX extension has been deprecated and moved to PECL.

9. Other Changes to Extensions

– GD:
. The behavior of imagecropauto() in the bundled libgd has been synced with
that of system libgd:
* IMG_CROP_DEFAULT is no longer falling back to IMG_CROP_SIDES
* Threshold-cropping now uses the algorithm of system libgd
. The default $mode parameter of imagecropauto() has been changed to
IMG_CROP_DEFAULT; passing -1 is now deprecated.
. imagescale() now supports aspect ratio preserving scaling to a fixed height
by passing -1 as $new_width.

– Filter:
. The filter extension no longer exposes –with-pcre-dir for Unix builds and
can now reliably be built as shared when using ./configure once more.

– Hash:
. The hash extension cannot be disabled anymore and is always an integral part
of any PHP build, similar to the date extension.

– Intl:
. The Intl extension now requires at least ICU 50.1.
. ResourceBundle now implements Countable.

– Libxml:
. All libxml based extensions now require libxml 2.7.6 or newer.

– Mbstring:
. The oniguruma library is no longer bundled with PHP, instead libonig needs
to be available on the system. Alternatively –disable-mbregex can be used
to disable the mbregex component.

– OPcache:
. The –disable-opcache-file|–enable-opcache-file configure options have been
removed in favor of the opcache.file_cache INI directive.

– PDO:
. It is now possible to escape question marks in SQL queries to avoid them
being interpreted as parameter placeholders. Writing “??” allows sending
a single question mark to the database and e.g. use the PostgreSQL JSON key
exists “?” operator. For more details see the RFC:

– Reflection:
. Numeric value of class, property, function and constant modifiers was
changed. Don’t filter methods and properties through
ReflectionClass::getMethods() and ReflectionClass::getProperties(), or test
results of Reflection…::getModifiers(), using hard-coded numeric values.
Use corresponding constants instead (e.g. ReflectionMethod::IS_PUBLIC).

– SimpleXML:
. SimpleXMLElement now implements Countable.

– SQLite3:
. The bundled libsqlite has been removed. To build the SQLite3 extension a
system libsqlite3 ‚Č• 3.7.4 is now required. To build the PDO_SQLite extension
a system libsqlite3 ‚Č• 3.5.0 is now required.
. (Un)serialization of SQLite3, SQLite3Stmt and SQLite3Result is now
explicitly forbidden. Formerly, serialization of instances of these classes
was possible, but unserialization yielded unusable objects.
. The @param notation can now also be used to denote SQL query parameters.

– Zip:
. The bundled libzip library has been removed. A system libzip >= 0.11 is now
necessary to build the extension.

10. New Global Constants

– Mbstring:
. MB_ONIGURUMA_VERSION specifies the version of the oniguruma library against
which mbregex has been built.

– Socket:
. Added FreeBSD-specific socket options:

– Standard:

– Tidy:

11. Changes to INI File Handling

– zend.exception_ignore_args
. New INI directive to include or exclude arguments from stack traces
generated for exceptions.

12. Windows Support

– stat:
. The stat implementation has been refactored.
– An inode number is delivered and is based on the NTFS file index.
– The device number is now based on the volume serial number.

Note that both values are derived from the system and provided as is on 64-bit
systems. On 32-bit systems, these values might overflow the 32-bit integer in
PHP, so they’re fake.

– CTRL+C and CTRL+BREAK on console can be caught by setting a handler function
with sapi_windows_set_ctrl_handler().

– configure now regards additional CFLAGS and LDFLAGS set as environment

– OPcache now supports an arbitrary amount of separate caches per user via the
the INI directive opcache.cache_id. All processes with the same cache ID and
user share an OPcache instance.

13. Migration to pkg-config

A number of extensions have been migrated to exclusively use pkg-config for the
detection of library dependencies. Generally, this means that instead of using
–with-foo-dir=DIR or similar only –with-foo is used. Custom library paths can
be specified either by adding additional directories to PKG_CONFIG_PATH or by
explicitly specifying compilation options through FOO_CFLAGS and FOO_LIBS.

The following extensions and SAPIs are affected:

– Curl:
. –with-curl no longer accepts a directory.

– Enchant:
. –with-enchant no longer accepts a directory.

– FPM:
. –with-fpm-systemd now uses only pkg-config for libsystem checks. The
libsystemd minimum required version is 209.

– GD:
. –with-gd becomes –enable-gd (whether to enable the extension at all) and
–with-external-gd (to opt into using an external libgd, rather than the
bundled one).
. –with-png-dir has been removed. libpng is required.
. –with-zlib-dir has been removed. zlib is required.
. –with-freetype-dir becomes –with-freetype.
. –with-jpeg-dir becomes –with-jpeg.
. –with-webp-dir becomes –with-webp.
. –with-xpm-dir becomes –with-xpm.

. –with-kerberos no longer accepts a directory.

– Intl:
. –with-icu-dir has been removed. If –enable-intl is passed, then libicu is
always required.

– Ldap:
. –with-ldap-sasl no longer accepts a directory.

– Libxml:
. –with-libxml-dir has been removed.
. –enable-libxml becomes –with-libxml.
. –with-libexpat-dir has been renamed to –with-expat and no longer accepts a

– LiteSpeed:
. –with-litespeed becomes –enable-litespeed.

– Mbstring:
. –with-onig has been removed. Unless –disable-mbregex has been passed,
libonig is required.

. –with-iodbc no longer accepts a directory.
. –with-unixODBC without a directory now uses pkg-config (preferred).
Directory is still accepted for old versions without libodbc.pc.

– OpenSSL:
. –with-openssl no longer accepts a directory.
. –with-kerberos no longer accepts a directory.

. –with-pcre-regex has been removed. Instead –with-external-pcre is provided
to opt into using an external PCRE library, rather than the bundled one.

– PDO_SQLite:
. –with-pdo-sqlite no longer accepts a directory.

– Readline:
. –with-libedit no longer accepts a directory.

– Sodium:
. –with-sodium no longer accepts a directory.

– SQLite3:
. –with-sqlite3 no longer accepts a directory.

– XSL:
. –with-xsl no longer accepts a directory.

– Zip:
. –with-libzip has been removed.
. –enable-zip becomes –with-zip.

14. Other Changes

15. Performance Improvements

– Core:
. A specialized VM opcode for the array_key_exists() function has been added,
which improves performance of this function if it can be statically
resolved. In namespaced code, this may require writing \array_key_exists()
or explicitly importing the function.

. When preg_match() in UTF-8 mode (“u” modifier) is repeatedly called on the
same string (but possibly different offsets), it will only be checked for
UTF-8 validity once.

Referrence: PHP.Net

Start using Git version control on the command line

If you want to start using Git version control and GitLab, make sure that you have created and/or signed into an account on GitLab.

Open a shell 

Depending on your operating system, you will need to use a shell of your preference. Here are some suggestions:

Check if Git has already been installed 

Git is usually preinstalled on Mac and Linux.

Type the following command and then press enter:

git --version

You should receive a message that tells you which Git version you have on your computer. If you don‚Äôt receive a “Git version” message, it means that you need to¬†download Git.

If Git doesn’t automatically download, there’s an option on the website to¬†download manually. Then follow the steps on the installation window.

After you are finished installing Git, open a new shell and type git --version again to verify that it was correctly installed.

Add your Git username and set your email 

It is important to configure your Git username and email address, since every Git commit will use this information to identify you as the author.

On your shell, type the following command to add your username:

git config --global "YOUR_USERNAME"

Then verify that you have the correct username:

git config --global

To set your email address, type the following command:

git config --global ""

To verify that you entered your email correctly, type:

git config --global

You’ll need to do this only once, since you are using the¬†--global¬†option. It tells Git to always use this information for anything you do on that system. If you want to override this with a different username or email address for specific projects, you can run the command without the¬†--global¬†option when you‚Äôre in that project.

Check your information 

To view the information that you entered, along with other global options, type:

git config --global --list

Basic Git commands 

Go to the master branch to pull the latest changes from there 

git checkout master

Download the latest changes in the project 

This is for you to work on an up-to-date copy (it is important to do this every time you start working on a project), while you set up tracking branches. You pull from remote repositories to get all the changes made by users since the last time you cloned or pulled the project. Later, you can push your local commits to the remote repositories.


When you first clone a repository, REMOTE is typically “origin”. This is where the repository came from, and it indicates the SSH or HTTPS URL of the repository on the remote server. NAME-OF-BRANCH is usually “master”, but it may be any existing branch.

View your remote repositories 

To view your remote repositories, type:

git remote -v

Create a branch 

To create a branch, type the following (spaces won’t be recognized in the branch name, so you will need to use a hyphen or underscore):

git checkout -b NAME-OF-BRANCH

Work on an existing branch 

To switch to an existing branch, so you can work on it:

git checkout NAME-OF-BRANCH

View the changes you’ve made¬†

It’s important to be aware of what’s happening and the status of your changes. When you add, change, or delete files/folders, Git knows about it. To check the status of your changes:

git status

View differences 

To view the differences between your local, unstaged changes and the repository versions that you cloned or pulled, type:

git diff

Add and commit local changes 

You’ll see your local changes in red when you type¬†git status. These changes may be new, modified, or deleted files/folders. Use¬†git add¬†to stage a local file/folder for committing. Then use¬†git commit¬†to commit the staged files:


Add all changes to commit 

To add and commit all local changes in one command:

git add .

Note: The . character typically means all in Git.

Send changes to 

To push all local commits to the remote repository:


For example, to push your local commits to the master branch of the origin remote:

git push origin master

Delete all changes in the Git repository 

To delete all local changes in the repository that have not been added to the staging area, and leave unstaged files/folders, type:

git checkout .

Delete all untracked changes in the Git repository 

git clean -f

Unstage all changes that have been added to the staging area 

To undo the most recent add, but not committed, files/folders:

git reset .

Undo most recent commit 

To undo the most recent commit, type:

git reset HEAD~1

This leaves the files and folders unstaged in your local repository.Warning: A Git commit is mostly irreversible, particularly if you already pushed it to the remote repository. Although you can undo a commit, the best option is to avoid the situation altogether.

Merge created branch with master branch 

You need to be in the created branch.

git checkout NAME-OF-BRANCH
git merge master

Merge master branch with created branch 

You need to be in the master branch.

git checkout master
git merge NAME-OF-BRANCH

Sumber: Gitlab.Com

Jom lihat kelebihan dan kenapa kita perlu beralih ke PHP 7.

Seperti yang semua sedia maklum melalui portal, rasmi telah menghentikan pembangunan PHP 5 (versi terakhir sehingga artikel ini ditulis adalah 5.6.30) dan mula fokus kepada pembangunan PHP 7:

The PHP development team announces the immediate availability of PHP 5.6.30. This is a security release. Several security bugs were fixed in this release. All PHP 5.6 users are encouraged to upgrade to this version.

According to our release calendar, this PHP 5.6 version is the last planned release that contains regular bugfixes. All the consequent releases will contain only security-relevant fixes, for the term of two years. PHP 5.6 users that need further bugfixes are encouraged to upgrade to PHP 7.

Jadi sudah masanya untuk kita turut mengemaskini server dan aplikasi agar selari versi terkini ini. Untuk itu jom kita lihat beberapa features baru yang terdapat dalam PHP 7 ini.

Null coalescing operator

The null coalescing operator (??) has been added as syntactic sugar for the common case of needing to use a ternary in conjunction with isset(). It returns its first operand if it exists and is not NULL; otherwise it returns its second operand.

// Fetches the value of $_GET['user'] and returns 'nobody'
// if it does not exist.
$username = $_GET['user'] ?? 'nobody';
// This is equivalent to:
$username = isset($_GET['user']) ? $_GET['user'] : 'nobody';

// Coalescing can be chained: this will return the first
// defined value out of $_GET['user'], $_POST['user'], and
// 'nobody'.
$username = $_GET['user'] ?? $_POST['user'] ?? 'nobody';

Spaceship operator

The spaceship operator is used for comparing two expressions. It returns -1, 0 or 1 when $a is respectively less than, equal to, or greater than $b. Comparisons are performed according to PHP’s usual type comparison rules.

// Integers
echo 1 <=> 1; // 0
echo 1 <=> 2; // -1
echo 2 <=> 1; // 1

// Floats
echo 1.5 <=> 1.5; // 0
echo 1.5 <=> 2.5; // -1
echo 2.5 <=> 1.5; // 1

// Strings
echo "a" <=> "a"; // 0
echo "a" <=> "b"; // -1
echo "b" <=> "a"; // 1

Constant arrays using define()

Array constants can now be defined with define(). In PHP 5.6, they could only be defined with const.

define('ANIMALS', [

echo ANIMALS[1]; // outputs "cat"

Session options

session_start() now accepts an array of options that override the session configuration directives normally set in php.ini.

These options have also been expanded to support session.lazy_write, which is on by default and causes PHP to only overwrite any session file if the session data has changed, and read_and_close, which is an option that can only be passed to session_start() to indicate that the session data should be read and then the session should immediately be closed unchanged.

For example, to set session.cache_limiter to private and immediately close the session after reading it:

'cache_limiter' => 'private',
'read_and_close' => true,

random_bytes & random_int

Generates an arbitrary length string of cryptographic random bytes that are suitable for cryptographic use, such as when generating salts, keys or initialization vectors.

Essentially secure way of generating random data. There are random number generators in PHP, rand() for instance, but none of the options in version 5 are very secure. In PHP 7, they put together a system interface to the operating system’s random number generator. Because we can now use the operating system’s random number generator, if that gets hacked we have bigger problems. It probably means your entire system is compromised and there is a flaw in the operating system itself.

Secure random numbers are especially useful when generating random passwords or password salt.

What does this look like for you as a developer? You now have 2 new functions to use: random_int and random_bytes.

$bytes = random_bytes(5);
var_dump(bin2hex($bytes)); // outputs string(10) "385e33f741"

Generates cryptographic random integers that are suitable for use where unbiased results are critical, such as when shuffling a deck of cards for a poker game.

Benchmarks for PHP 7 consistently show speeds twice as fast as PHP 5.6 and many times even faster! Although these results are not guaranteed for your project, the benchmarks were tested against major projects, Drupal and WordPress, so these numbers don’t come from abstract performance tests.

var_dump(random_int(100, 999)); // outputs int(248)
var_dump(random_int(-1000, 0)); // outputs int(-898)

Selain itu antara kelebihan yang ada pada PHP 7 adalah lebih laju daripada PHP 5.6

Benchmarks for PHP 7 consistently show speeds twice as fast as PHP 5.6 and many times even faster! Although these results are not guaranteed for your project, the benchmarks were tested against major projects, Drupal and WordPress, so these numbers don’t come from abstract performance tests.

Untuk rujukan dan maklumat lebih lanjut, sila refer ke pautan berikut:

Sublime Text 3 Plugin For Fast Coding

Sublime Text 3 adalah satu editor yang saya gunakan untuk membuat kod-kod pengaturcaraan. Walaupun ia harus mempunyai lesen berbayar, namun harga lesennya adalah agak murah berbanding kepelbagaian ciri-ciri yang ada padanya. Hampir semua ciri-ciri yang saya perlukan semasa membuat kod untuk membangunkan sesebuah laman web terdapat pada aplikasi ini. Ini membantu saya membangunkan laman web yang dikehendaki dengan lebih mudah dan cepat.

Saya menggunakan OS Windows 10. Di antara Sublime Text 3 Plugin yang wajib pada saya perlu dipasang sebelum Sublime Text 3 anda menjadi lebih superb adalah seperti berikut:

1. Control Package

Control Package merupakan pengurus setiap package yang anda pasang/kemaskini/buang. Shortcut-key: Ctrl + Shift + P

2. Alignment

Alignment memudahkan akan untuk menyusun kod anda agar lebih teratur
Shortcut-key: Ctrl + Alt + A

3. Emmet

Plugin wajib yang mencepatkan untuk menghasilkan kod melalui shortcut yang telah ditetapkan oleh plugin ini. Untuk senarai shortcut, sila ke url berikut –¬†

4. SidebarEnhancement

Plugin ini akan menambah menu pada sidebar yang terdapat dalam Sublime Text 3. Pada asasnya sidebar sedia ada dalam Sublime Text 3 adalah sangat asas.

5. ColorPicker

ColorPicker memudahkan kita untuk memilih warna yang dikehendaki untuk menetapkan warna tulisan, background dan sebagainya. Sebelum ini saya terpaksa membuka another browser tab untuk melihat HEX bagi sesuatu warna.
Shortcut-key: Ctrl + Shift + C

6. Color Highlighter

Color Highlighter memudahkan kita untuk melihat warna setelah hexadecimal (HEX) ditulis. Sebelum ini saya terpaksa refresh page yang telah dibuat untuk melihat hasil warna yang dipilih.

7. Bootstrap 3 Snippets

Snippets untuk Twitter Bootstrap 3. Untuk menghasilkan elemen form, table, alerts, badges, carousel, icons, images, pagination, navigations, panel dan sebagainya
Shortcut-key: bs3-*

8. GIT

Saya menggunakan version control system (VCS) GIT. Melalui plugin ini, aplikasi GIT dapat diintergrasikan dengan Sublime Text 3. Namun begitu, saya masih suka menggunakan git bash :p. Setelah pemasangan GIT, jangan lupa untuk menetapkan dalam Environment Variables > System Variables > Path dan tambahkan lokasi pemasangan cthnya: D:\Software\Git\bin.

9. GitGutter

Plugin GIT sahaja tidak lengkap tanpa dipasang plugin GitGutter. Plugin ini memudahkan kita untuk melihat perbezaan apabila berlaku conflict. Kita dapat melihat perbezaan yang ditambah/dibuang/diubah

10. Predawn Theme

Tema kegemaran saya. Tema ini menukar icon yang terdapat dalam Sublime Text 3. Tema Predawn ini juga menyediakan skema warnanya sendiri iaitu Predawn Monokai

11. Material Theme

Selain daripada Predawn, tema ini juga kelihatan menarik untuk digunapakai pada Sublime Text 3 anda.

12. HTML5

Snippets HTML5 untuk aplikasi Sublime Text 3.

13. HTMLBeautify

Plugin untuk membetulkan format (indents) kod HTML. Tujuan indents ini adalah untuk memudahkan kod kita dibaca oleh pengaturcara lain.
Shortcut-key: Ctrl + Alt + Shift + F

14. SublimeLinter

Sekiranya anda inginkan plugin yang memudahkan anda untuk melihat kesilapan semasa menulis kod, plugin ini adalah pilihan yang terbaik. Kesilapan seperti close bracket yang tertinggal dapat dikesan dengan mudah.

15. GitStatus

Saya baru memasang plugin ini (13/05/2016) dan memudahkan saya untuk melihat status pada¬†setiap perubahan yang dilakukan dalam¬†repository projek. Status ini dipaparkan pada ‘command palette’ seperti¬†Git: Dirty, Git: Clean, Git: Changed files dan Git: Unmerged files

Terdapat juga beberapa plugin yang saya rasa bagus dipasang sekiranya anda menggunakan PHP Framework: Laravel 5 seperti berikut:

1. Laravel 5 Artisan

2. Laravel 5 Snippets

3. Laravel Blade Highlighter

Akhir sekali bagi mereka yang baru menggunakan Sublime Text 3 bolehlah memasang plugin berikut untuk memudahkan serta mempercepatkan kita mempelajari dan mahir menggunakan Sublime Text 3

1. Sublime Tutor

Update: 11/06/2016

1. BracketHighlighter

2. Autoprefixer

Update: 20/04/2017

1. AdvancedNewFile

2. JavaScript & NodeJS Snippets

Update: 12/09/2018

1. All Autocomplete

PHP OOP : Siri1 – Apa itu OOP dalam PHP

Tahun 2016 ini jom kita belajar PHP OOP. PakCu akan cuba untuk menterjemahkan konsep OOP dalam PHP sebaik yang mungkin akan lebih mudah untuk dipahami dan dipelajari. Terlebih dahulu, kita semua perlu buangkan tanggapan bahawa mempelajari OOP adalah sangat susah dan kompleks. Setiap benda sekiranya selalu diamalkan akan menjadi mudah akhirnya. Sebagai contoh, cuba tulis nama ada menggunakan tangan kiri (bagi mereka yang lazimnya menggunakan tangan kanan).

Susah bukan? Walaupun nama tersebut biasa kita tulis tapi apabila kita keluar daripada kelaziman kita; bagi kes ini kita menggunakan tangan kiri untuk menulis nama kita, kita akan dapati benda tersebut sukar dilakukan. Begitu juga dengan mempelajari OOP. Pada awalnya akan ada sedikit kesukaran untuk memahami. Namun setelah kita paham dan tahu cara penggunaannya, ia akan memudah dan memahirkan kita.

Secara kita tidak sedar, ada antara kita sebenarnya telah mula menggunakan konsep, struktur dan fungsi asas yang terdapat dalam OOP. Cuma dalam OOP, ia mempunya istilahnya sendiri seperti properties, methods, encaplution, instance dan sebagainya. Insyallah tutorial PHP OOP akan ada beberapa bahagian/siri. Untuk Siri 1 kali ini, PakCu akan lebih kepada pengenalan kepada OOP. Banyak PHP framework yang terdapat dalam pasaran menggunakan konsep OOP dalam struktur framework mereka. Ini disebabkan fungsi OOP telah mengalami perubahan yang besar setelah PHP5 diperkenalkan.

Classes, Properties dan Methods

Class adalah satu blueprint @ template yang menerangkan sesuatu objek. Melalui template ini, berbagai objek yang sama tetapi mempunyai ciri-ciri yang berbeza dapat dihasilkan. Sebagai contoh objek ialah pengguna, apabila kita membina class pengguna ia akan mengandungi maklumat/data/ciri-ciri pengguna. Di dalam OOP, ciri-ciri ini dikenali sebagai properties dan methods.

Untuk menambah/menetapkan data ke dalam sesuatu class, kita menggunakan properties atau lebih dikenali sebagai variables dalam procedural PHP. Contoh properties yang boleh ditetapkan dalam class pengguna adalah id pengguna, email, jantina dan sebagainya.

Method pula adalah kaedah yang lazimnya dipanggil function dalam procedural PHP. Contoh methods yang boleh dicipta dalam class pengguna adalah daftar masuk, daftar keluar, tambah pengguna, hapus pengguna dan sebagainya.

Setelah class dihasilkan,¬†class ini boleh digunakan untuk menetapkan/mencipta pelbagai pengguna lain tetapi berbeza data/maklumat/ciri. Jadi kenapa perlu belajar OOP ini? Dengan adanya ilmu OOP ini kita tidak lagi perlu menulis kod-kod pengaturcaraan secara berulang-ulang untuk sesuatu fungsi. Terdapat istilah DRY (Don’t Repeat Yourself)¬†yang perlu kita amalkan¬†dalam menghasilkan sesuatu aplikasi agar¬†kod kita lebih teratur, mudah dipahami dan yang paling penting senang untuk diselenggara pada masa akan datang sekiranya perlu.

Jumpa lagi di Siri 2 akan datang dengan tajuk Mencipta dan Menggunakan Class.

%d bloggers like this: