PHP and C
| From: | Ethan Rosenberg | Date: | Fri, 17 Jul 2015 04:11:42 +0000 |
| Subject: | PHP and C | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-324996@lists.php.net to get a copy of this message | ||
Dear list -
PHP script calls a C program --
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<!-- Scanf.php -->
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
<style>
body{
background-color: #89caeb;
width:100%;
height:100%;
position: relative;
font-family: "Helvetica", "Arial" , "Liberation Sans", "Free sans", sans-serif;
overflow-y: scroll;
}
.wgh{
font-size: 14pt;
align: center;
font-weight: bold;
}
</style>
</head>
<body>
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
error_reporting(E_ALL | E_NOTICE);
ini_set('display_errors','1');
$number = /var/www/TestScanf;
echo 'number in php<br />';
echo $number;
?>
</body></html> //TestScanf.c //works perfectly as a stand alone #include <stdio.h> int main(void) {
int num;
printf("Enter your Number ");
scanf("%d", &num);
printf("%d\n", num);
return (num);
}
Output -
number in php
Enter your Number 0
TIA
Ethan