xp_before

xp_before($signal, $process)

Execute a function before a signal is emitted.

Parameters:
  • object – \XPSPL\SIG
  • callable|process – PHP Callable or \XPSPL\Process.
Return type:

object \XPSPL\Process

Example #1 Basic Usage

<?php

xp_signal(XP_SIG('foo'), function(){
    echo 'foo';
});

xp_before(XP_SIG('foo'), function(){
    echo 'before foo';
});

// results when foo is emitted

The above code will output.

// before foo foo