I have created a page

myfunction.php and added two functions:

function AppNotify ($Uid,$ Message,$ Data)
{
    return;
}

function AppNotifyUnfriend($Uid,$ Message,$ Data)
{
    return;
}

After that I created another page and include “myfunction.php” on these page
then create code

$done= AppNotify (‘12’,’hello’,’Delete’);
$done2= AppNotifyUnfriend(‘12’,’hello’,’Delete’);

The problem is when i run myfunction.php, it’s only run first “AppNotify”. didn't run the 2nd function.

Then I change the code on the myfunction.php

$done2= AppNotifyUnfriend(‘12’,’hello’,’Delete’);
$done= AppNotify (‘12’,’hello’,’Delete’);

Now it’s run ‘AppNotifyUnfriend’.

Question) why it’s not running the 2nd function

I have also directly run

AppNotify (‘12’,’hello’,’Delete’);
AppNotifyUnfriend(‘12’,’hello’,’Delete’);

and then

AppNotifyUnfriend(‘12’,’hello’,’Delete’);
AppNotify (‘12’,’hello’,’Delete’);

Same error

To start... if that is a direct copy, you shouldnt have spaces after the $

so.. change

function AppNotify ($Uid,$Message,$Data)
 {
  return;
 }
function AppNotifyUnfriend($Uid,$Message,$Data)
 {    
  return;
 }

and see if that makes any changes...

otherwise, personally I would need more info than that to help... something is missing.

or create a

class myFunction{
function AppNotify ($Uid,$ Message,$ Data)
{
     return;
}
function AppNotifyUnfriend($Uid,$ Message,$ Data)
{
     return;
}
}//End myFunction

require_once in your file instead of include and call the functions the way you need it.

exemple:

$app = new myFunction();
$app->AppNotify(x, y, z);
$app->AppNotifyUnfriend(x, y, z);

and so on.

have fun.

Dark

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.