apd_croak

(PECL apd 0.2-0.4)

apd_croakThrow an error, a callstack and then exit

설명

void apd_croak ( string $warning [, string $delimiter = "<BR />" ] )

Behaves like perl's Carp::croak. Throw an error, a callstack and then exit.

인수

warning

The warning to throw.

delimiter

The delimiter. Default to <BR />.

반환값

값을 반환하지 않습니다.

예제

Example #1 apd_croak() example

<?php
apd_croak
("Some Warning","<P>");
?>

참고

add a note add a note

User Contributed Notes 1 note

up
-1
php at peous dot com
19 years ago
A function that "ASSERTS", ie that dies if the boolean in parameter is false
ex: verify( $myDatabase->Connect() );

<?php
function verify( $bResult )
{
    if (!
bResult)
    {
        echo
"<hr><h1>ERROR</h1><hr>";
        echo
"<pre>Last call arguments:\n";
        for(
$i=0;$i<func_num_args();$i++)
        {    echo
"&rarr;";
           
print_r( func_get_arg ($i) );
            echo
"&larr;\n";
        }
        if (
sizeof($_GET))
        {    echo
"<hr>GET VARS\n";
           
print_r( $_GET );
        }
        if (
sizeof($_POST))
        {    echo
"<hr>POST VARS\n";
           
print_r( $_POST );
        }
        if (
sizeof($_SERVER))
        {    echo
"<hr>SERVER VARS\n";
           
print_r( $_SERVER );
        }
        if (
sizeof($_COOKIE ))
        {    echo
"<hr>COOKIE VARS\n";
           
print_r( $_COOKIE  );
        }
       
// Disable if not on a protected server
       
if (sizeof($_SESSION ))
        {    echo
"<hr>SESSION VARS\n";
           
print_r( $_SESSION  );
        }       
        echo
"</pre>";
        echo
"<hr>";
        if (
function_exists("apd_callstack"))
        {   
apd_croak("Error !");
        }
        else
        {    die(
1);
        }
    }
}
?>
To Top