Convert C++ to PHP/HTML

Can anyone help me how to Convert this Code to A PHP program

/*Banker safety Algorithm

#include < iostream >
using namespace std;
#define MAX 200 // Maximum no of process & Resource type
int main()
{
	int Allocation[MAX][MAX],Maxi[MAX][MAX],Available[MAX],Need[MAX][MAX],n,m,i,j,Work[MAX],Safe[MAX],l,k;
	bool Finish[MAX];
	while(printf("\
Input No of process & No of resource type: "),~scanf("%d%d",&n,&m))//n=no of process;m=no of resource type
	{
		printf("Input Allcation Matrix :\
");
		for(i=0;i<n;i++)
			for(j=0;j<m;j++)
				scanf("%d",&Allocation[i][j]);

		printf("Input Max Matrix :\
");
		for(i=0;i<n;i++)
			for(j=0;j<m;j++)
				scanf("%d",&Maxi[i][j]);

		printf("Input Available for each resource type:\
");
		for(j=0;j<m;j++)
			scanf("%d",&Available[j]);

		// Create Need matrix for each process
		for(i=0;i<n;i++)
			for(j=0;j<m;j++)
				Need[i][j]=Maxi[i][j]-Allocation[i][j];

		//initialize work & finish
		for(i=0;i<m;i++)
			Work[i]=Available[i];
		for(i=0;i<n;i++) Finish[i]=false;

		l=0;

		int  loop,start=0;bool f;

		//STEP 2 FOR BANKERS ALGORITHM
step2:
			for(i=start,loop=0;loop<n;i++,loop++)
			{
				if(i==n)
					i=0;
                f=false;
				if(Finish[i]==false)
				{
                    for(j=0;j<m;j++)
					if(Need[i][j]>Work[j])
						f=true;
                    if(f==false)
					goto step3;
				}
			}
			if(f==false)
			goto step4;

         //STEP 3 FOR BANKERS ALGORITHM
step3:
           Safe[l++]=i;
			for(k=0;k<m;k++)
				Work[k]+=Allocation[i][k];
			Finish[i]=true;
			start=i+1;
            goto step2;							

            //STEP 4 FOR BANKERS ALGORITHM
step4:
				for(i=0;i<n;i++)
					if(Finish[i]==false)
						printf("System is not in Safe state\
");
				if(i==n)
				{
					printf("System is in Safe state\
The sequence of process is to be execute:");
					for(i=0;i<l;i++)
						printf(" %d ",Safe[i]);
					printf("\
");
				}

}
return 0;
}

That looks like a fairly straight-forward task, if you know a minimum of PHP. I’d recommend taking a look at a PHP tutorial and the [url=http://www.php.net]PHP documentation.

i know a minimum of PHP but I dont know how to covert a C to a PHP…
where you are going to input number of rows and columns in textfield
and the textfield will have its unique ID…

hope that you will help me :frowning:

Well see that is your problem you are trying to convert existing code. What you should be doing is writing new code in PHP the has the same result.