about develop c/c++ extend
Posted: Tue Jan 05, 2010 2:30 am
we usually write the arithmetic in PHP.
for example an easy arithmetic in PHP easy.php
if we write it in C++ easy.cpp
I have a problem that use c/c++ develop the php's arithmetic extend.
if we compile the "easy.cpp" to "easy.dll"(windows) or "easy.so"(linux) ,and than let php invoke the "dll" or "so" cover for "easy.php".
which code is faster ? invoke the "dll,so" or only use php ?
for example an easy arithmetic in PHP easy.php
Code: Select all
<?php
for($i=1;$i<=10;$i++)
{
echo $i."<br />";
}
Code: Select all
#include <iostream>
int main()
{
int i = 0;
for(i=1;i<=10;i++)
{
std::cout << i << std::endl;
}
return 0;
}
if we compile the "easy.cpp" to "easy.dll"(windows) or "easy.so"(linux) ,and than let php invoke the "dll" or "so" cover for "easy.php".
which code is faster ? invoke the "dll,so" or only use php ?