Difference between C and PHP(C vs PHP)

C

  • History-C is a programming language design by Denis Ritchie in AT & T Bells labs in 1972.
  • Versions-Latest version of C is C11.
  • C language type discipline is static and weak where as of PHP is dynamic and weak.
  • Extension- File extension for C is .c, .h.
  • Paradigms-C paradigms are imperative ,procedural and structural.
  • C language support pointers
  • C is used for writing highly intensive application.
  • C programming doesn’t do string copying do for error checking and bound checking.
  • C is slower in certain condition as compared to PHP.
  • Filesafe IO and system calls are not offered by C.
  • C doesn’t include any garbage collector Boehm GC can be used as a garbage collector for C.
  • C support manual memory management with library tools malloc and free.
  • C use semicolon as statement terminator and comma as for separation.
  • Type identifiers supported by C are int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t, int, unsigned int, char, unsigned char, short ,long, double.
  • C support single precision float, double and long double.
  • C support single precision and double precision complex numbers.
  • C support fixed size array and one-dimensional dynamic size array.
  • In C syntax for accessing the array is name[index].
  • C doesn’t support associative array using third party we can include these types of array in libraries to used it.
  • C use strcat() function for string concatenation.
  • The system is very rigid in C. C doesn’t let any mistake get into the environment and can be frustrating in the development process when looking for bugs.
{`Hello World program in C
 #include<stdio.h>
 int main()
 {
 printf("Hello World");
 }`}
 

PHP

  • History-PHP is product from the PHP GROUP released in 1995.
  • Versions- 5.5.14 is the latest version of PHP.
  • PHP language type discipline is dynamic and weak.
  • Extension- PHP extension are .php, .php3,.php4, .php5, .phtml ,phps.
  • Paradigms- PHP is imperative, functional, object-oriented and reflective.
  • PHP language doesn"t support pointers.
  • PHP falls short for such type of application.
  • PHP programming do string copying and donot do for error checking and bound checking.
  • PHP is faster as compared to C.
  • Filesafe IO and system calls,PHP support for the both.
  • PHP support garbage collection and there is also gc_enable function.
  • PHP support automatic memory management with reference counting.
  • PHP use semicolon for terminating statement doesn’t use commas.
  • Type identifiers support by PHP are 32 bit unsigned int and 64 bit signed bit.
  • PHP support double precision float and single precision float, double and long double.
  • PHP doesn’t support complex numbers.
  • PHP doesn’t support fixed size array it support only one-dimensional dynamic size array.
  • In PHP syntax for accessing the same array id $name[index].
  • Built in PHP type array are associative type also PHP internally include the numerical indexes of the array.
  • PHP use + operator to concatenate the function of the data structure.
  • General permissiveness of the programs has PHP to be more lenient.PHP is more forgiving with new mistakes.
  • PHP visibility over internet is secure because use on open source platform.
{`Hello World program in PHP*/
 <?php echo 'Hello World'; ?>`}