0

Can anybody explain about how practically it is possible to implement a coding structure which encapsulates C++ opcodes in php code. I assumes the consumption of memory and cpu are more in the case when executing DML statements in SQL queries having INSERT,SELECT, UPDATE, DELETE ?

Is it possible to convert following PHP code block of INSERT into a c++ opcode ?

// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
    }

$sql = "INSERT INTO MyGuests (firstname, lastname, email)
VALUES ('John', 'Doe', 'john@example.com')";

 if ($conn->query($sql) === TRUE) {
 echo "New record created successfully";
     } 
    else {
  echo "Error: " . $sql . "<br>" . $conn->error;
     }

Which all are other situations we can use these coding structure in point to reduce the resource usage in server ?

Tom
  • 500
  • 3
  • 5
  • 16
  • 1
    Facebook (or rather, Andrei) implemented a PHP to C++ translator.called [HipHop](https://en.wikipedia.org/wiki/HipHop_for_PHP), which is now discontinued. They now use a virtual machine instead. I suggest you look into that if you're after performance, but I advice you to just get away from PHP - [it's Evil](http://blog.codinghorror.com/the-php-singularity/). – Cheers and hth. - Alf Jan 31 '16 at 05:26
  • Thanks for the feedback.. I assume are you pretending that PHP is not a stable language to afford force traffic? My stuff is developed in PHP , is there any other viable option you have in this situation ? – Tom Jan 31 '16 at 05:32
  • As @cheers stated, Facebook moved to their own PHP implementation [**HHVM**](http://hhvm.com/). It acts as alternative to the Zend Engine ("original PHP") and also supports the *Hack* language which augments PHP. HHVM is open source and considering it powers *Facebook*, it should have good performance. The Zend Engine has also made significant performance improvements with recent updates, most notably with the OpCache and during the development of PHP 7. For many **web** use-cases, recent PHP is fast enough, but it is not made for high-performance processing. – Lukas Jan 31 '16 at 06:02

0 Answers0