Results 1 to 4 of 4

Thread: How to call a C functions within PHP?

  1. #1
    Join Date
    Aug 2008
    Posts
    129

    How to call a C functions within PHP?

    I have heard that calling C function within the PHP is possible How do we call C function in PHP? If anyone come across this please let me know. This will be an added information in my knowledge.

  2. #2
    Join Date
    Mar 2008
    Posts
    232

    Re: How to call a C functions within PHP?

    We can call some of the C functions from PHP, like printf() fputs() fwrite() fgetc() exit() and so many others. You can write a SOAP webservice in C and then call it using PHP. But we cannot call all of C functions for example we cannot call initgraph() function that is a part of turbo C and I don't think that there is any way to call custom C functions from PHP

  3. #3
    Join Date
    Jan 2009
    Posts
    143

    Re: How to call a C functions within PHP?

    Even though we can call C functions in php but at the same time You can't call a function inside another program written in totally different language in php. What you can do is you can write a program in c and call the program from command line with commandline arguments and echo the output. You could also make your own PHP module with the functions in it. Why do you want to call C functions within PHP?

  4. #4
    Join Date
    Jan 2009
    Posts
    99

    Re: How to call a C functions within PHP?

    PHP has many native functions that have the same name as C functions and which act in similar ways but they are not C functions they are PHP functions. If you are using Windows and the API is contained within a DLL (which is often the case) then you could call it via rundll32, which you can call via the PHP system() function.

Similar Threads

  1. Replies: 14
    Last Post: 09-04-2012, 02:49 PM
  2. Replies: 6
    Last Post: 28-02-2012, 10:21 PM
  3. Replies: 6
    Last Post: 23-10-2011, 08:09 PM
  4. Can I Define and Call my Own Functions in JavaScript?
    By Rob Dizzle in forum Software Development
    Replies: 5
    Last Post: 09-02-2010, 05:18 AM
  5. Replies: 5
    Last Post: 13-01-2010, 09:29 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,017,846.07943 seconds with 17 queries