Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an equivalent to C#’s Process.Start in PHP?

  1. In .NET The Process class contains several useful properties/methods that allow developers to access process relative information. Is there any equivalent method or class in PHP?

  2. Is there any equivalent method in PHP like C# method "Process.Start()"?

like image 216
Karandeep Singh Avatar asked Jun 05 '10 05:06

Karandeep Singh


People also ask

Is there a replacement for C?

Some programmers consider popular languages like Rust, Go, D, and Carbon as C/C++ replacements. Meanwhile, some programmers consider using those languages as C/C++ alternatives that might replace C/C++ in the future.

What is the alternative to class for C?

You can swap "Class" in C++ for "struct".

Is there something faster than C?

This is why Fortran is often faster than C. This is why numerical libraries are still written in Fortran. However, it comes at the cost of pointer arithmetic.

Is C or C+ Better?

Compared to C, C++ has significantly more libraries and functions to use. If you're working with complex software, C++ is a better fit because you have more libraries to rely on. Thinking practically, having knowledge of C++ is often a requirement for a variety of programming roles.


2 Answers

1. See Program execution Functions

Except there's no concept of methods/classes/properties/namespaces in the PHP standard functions. PHP is essentially a procedural programming language with few OOP constructs and namespace support being added as a new feature as of the last major release (5.3). It's one of the reasons why people criticise it as a 'toy' language. You can access all of the PHP built-in functions all the time, no pesky namespaces to get in the way ;), just be careful of name collisions.

2. @YSJaitawat Right answer bad reference.

Click this link for the exec function documentation in the PHP manual.

Note: Also, if you're migrating from C# to PHP and looking for info the PHP manual has some surprisingly good info including user-submitted comments at the bottom of the entry where people usually post use-cases or extensions to the standard uses. It's probably the easiest language to learn because of the wealth of info to be found in the manual.

like image 91
Evan Plaice Avatar answered Oct 06 '22 08:10

Evan Plaice


Following code snippet should do the same as "Process.Start()"

$executable = 'executable process'; exec($executable);

more on process control and execution can be found at http://php.net/manual/en/book.pcntl.php

like image 25
YSJaitawat Avatar answered Oct 06 '22 08:10

YSJaitawat