write less do more

PHP

How to save the resource in our project code? Should we repeat writing the same code in every page/file? We can save a lot of our time and resource by putting the same code or lines into a function or procedure.

In some programming language, such as Pascal, Batch, C, PHP, etc., we can make a single special file where we can store our functions and procedure, also some constant.

Files which stored functions and procedures generally called “library“. The reason? coz it store many functions… I don’t know the other reasons.. 😀

For some constant (variables that store fixed value), we can put it on a editable file, like “config.php” in PHP or “config.tpu” in Pascal. So if we need some constant, we only need to call that file.

For example, we have some web pages that require same coding and data, but in different web design, should we write the same codes in every page? and how if there’s a minor change in the codes? it will make us work on those page again.

We can solve that problem by creating a single file that contain the function, and call the function from every page. So, if there’s any change on the code, we have to modify the file that contain the function only. In PHP, you can also include the file with “include()” function rather than calling for the function.

There a lot of free library out there, so you can use them to decrease your time in coding. For example jQuery, it is a free javascript library that store many function. There’s also Mootools, it’s has same function with jQuery.

Andi Setiawan

Loving husband - Caring Father - Slap bet Commissionaire (I wish) find my complete profile on: http://andisetiawan.com/about-me http://facebook.com/andiim3 - http://gplus.to/andiim3 - http://andiim3.com

Share
Published by
Andi Setiawan

Recent Posts

Dedicated Blog for Dobby and Luna

Dobby and Luna have been part of our lives for the past years. They have…

2 years ago

Demo Site For My Projects

In the year 2021, I've completed some paid projects. Some of them are more technical,…

2 years ago

GlassTime – Glassmorphism WordPress Theme

Based on the GlassTime Bootstrap template, here I present glassmorphism WordPress Theme free to download.This…

3 years ago

GlassTime : Glassmorphism Responsive HTML5 Template

This HTML5 template is using Glassmorphism UI design language which is now trending for 2021…

3 years ago

Daftar Desa, Kecamatan, dan Kode Pos Buleleng – Bali

KecamatanKode POSBanjar81152Buleleng81119Busungbiu81154Gerokgak81155Kubutambahan81172Sawan81171Seririt81153Sukasada81161Tejakula81173Klik pada nama kecamatan untuk melihat daftar desa masing-masing. Sumber: kodepos.andiim3.com

3 years ago

Ninja diganti ADV

Ada yang bilang "semuanya akan mati matic pada akhirnya". Bener aja, sekarang tuntutan transportasi sehari-hari…

4 years ago

This website uses cookies.