Software languages

What is the differnce between Structure and Union?

The difference between structure and union is, 1. The amount of memory required to store a structure variable is the sum of the size of all the members. On the other hand, in case of unions, the amount of memory required is always equal to that required by its largest member. 2. In case of […]

How to resize image using php?

Here is a simple script to resize the given image. This requires PHP5, GD library. First download the file and include to your code. Usage example: 1 2 3 4 5 6 7 8 9 10 11 12 <?php // *** Include the class include("resize-class.php");   // *** 1) Initialise / load image $resizeObj = […]

How to Extract or Unzip files from a .zip file using PHP

Here is the simple code which will extract a zip file. Here we are using pclzip.lib file to extract files. You no need to install any other library to your server. First download pclzip.lib file. Now use the below code to extract your zip file. 1 2 3 4 5 6 7 8 9 10 […]

How to convert Digits or numbers to word using PHP?

Here is the code to convert digits to word using PHP Example: 564 : five hundred sixty four 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 […]

How to get image source from file using PHP

Use preg_match_all to get the image source from your file. PHP code: 1 2 3 4 5 6 7 8 <?php $content=’Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industrys standard dummy text ever since the 1500s, when an unknown printer took a galley of type […]

How to send enquiry or feedback mail using PHP script

The PHP mail() function is used to send emails from inside a script. Syntax: mail(to,subject,message,headers,parameters) Here is an example of PHP feedback-form which you can directly publish on your website. The example below sends a message to a specified e-mail address. This PHP form includes Name, Email ID, Phone No, Subject, Message. Here JavaScript validation […]

How static variable and static functions will work?

The keyword static can be used in three major contexts: inside a function, inside a class definition, and in front of a global variable inside a file making up a multifile program. The use of static inside a function is the simplest. It simply means that once the variable has been initialized, it remains in […]

What is the difference between calloc and malloc?

1. calloc allocates a block of memory for an array of elements of a certain size. By default the block is initialized to 0. The total number of memory allocated will be (number_of_elements * size). malloc takes in only a single argument which is the memory required in bytes. malloc allocated bytes of memory and […]

What is function pointer and how to use function pointer?

A function pointer is a variable which is used to hold the starting address of a functions and the same can be used to invoke a function. It is also possible to pass address of different functions at different times thus making the function more flexible and abstract. So the function pointers can be used […]

What is the difference between macro and function?

Here are the differences between macro and function, 1.Macro consumes less time: When a function is called, arguments have to be passed to it, those arguments are accepted by corresponding dummy variables in the function. Then they are processed, and finally the function returns a value that is assigned to a variable (except for a […]