473,394 Members | 1,645 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

confused - can not find PHP API function for 'die'

R
Hello everybody.

I'm looking for PHP API function for 'die'

I'm messing with my own function - it's my own 'var_dump' - 'myDump'

It works fine, but I want to end script after dumping variables.

I found that Zend's lexer return T_EXIT token and creates zend_do_exit
code - but I guest it's not what I need.

So the question is:
How can I end script from PHP API? I want to achieve exactly the same
effect as:

---
myDump($object);
die();
---

but I want it all in one function as:
---
myDump($object);
---

thanx in advance
cheers R

Aug 1 '05 #1
3 1643
R wrote:
Hello everybody.

I'm looking for PHP API function for 'die'

I'm messing with my own function - it's my own 'var_dump' - 'myDump'

It works fine, but I want to end script after dumping variables.

I found that Zend's lexer return T_EXIT token and creates zend_do_exit
code - but I guest it's not what I need.

So the question is:
How can I end script from PHP API? I want to achieve exactly the same
effect as:

---
myDump($object);
die();
---

but I want it all in one function as:
---
myDump($object);
---

thanx in advance
cheers R


R,

Why wouldn't you just call exit() from within your function?

function myDump($object) {
//do something with object...
exit();
}

Carl.
Aug 1 '05 #2
R

Carl wrote:
Why wouldn't you just call exit() from within your function?

function myDump($object) {
//do something with object...
exit();
}


because I want to create PHP API function - forgive me but I know how
to exit my script in plain PHP....

PHP API goes sth like this:

PHP_FUNCTION(myDump)
{
zval *var;
zend_bool i = 0;

if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|b", &var,
&i) == FAILURE) {
RETURN_FALSE;
}

/* do my thing in C */

}

and I want to call die function from myDump - but I can not make it.

thanks in advance for any help
cheers R

Aug 2 '05 #3
R wrote:
Carl wrote:
Why wouldn't you just call exit() from within your function?

function myDump($object) {
//do something with object...
exit();
}

because I want to create PHP API function - forgive me but I know how
to exit my script in plain PHP....

PHP API goes sth like this:

PHP_FUNCTION(myDump)
{
zval *var;
zend_bool i = 0;

if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|b", &var,
&i) == FAILURE) {
RETURN_FALSE;
}

/* do my thing in C */

}

and I want to call die function from myDump - but I can not make it.

thanks in advance for any help
cheers R

R,

O.K., The fact that you were trying to write an extension using the API
was not clear to me from your initial post.

Also, it may be helpful to know that die()/exit() are actually
implemented as a language construct in php, not as a function.

You may want to try and repost this on the php-dev ML as you will
probably get more appropriate answers there.

Carl.
Aug 2 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Xah Lee | last post by:
© # -*- coding: utf-8 -*- © # Python © © import sys © © nn = len(sys.argv) © © if not nn==5: © print "error: %s search_text replace_text in_file out_file" % sys.argv
1
by: Xah Lee | last post by:
suppose you want to do find & replace of string of all files in a directory. here's the code: ©# -*- coding: utf-8 -*- ©# Python © ©import os,sys © ©mydir= '/Users/t/web'
13
by: Marvin | last post by:
Hi: I have been programming with OOP and C++ for over 10 years but I am new to javascript. I am very confused about one aspect and would appreciate it if someone could explain the differences...
1
by: Vagabond | last post by:
ok I have been potring a CGI script to PHP but have run into a small problem. I can't seem to get the script to find my data file even though I used the same code just fine in other scripts. ...
26
by: Dodger | last post by:
Okay, background... yes, I am another of those evil, spurned, damnable Perl mongers, but I'm not trying to start a flamewar, I'm juust tryung to understand something... I can write a script in...
4
by: vcinquini | last post by:
I've always learned about typedef as a statement that creates an alias for a type. For example: typedef long DWORD; but I'm confused about the following typedef. Which is the type and which...
12
by: Shawn Northrop | last post by:
Ive been searching for an image resize tutorial for a while now and found this code which worked nicely. I was unable to find the full source code but i think i pieced together the code from the...
2
by: manishabh77 | last post by:
can anyone suggest how I can find files in directories and subdirectories and copy them into a new directory.I tried the following code but it doesnot do the job. $inputfile1 = "file_index.txt"; ...
11
by: ezechiel | last post by:
hi, I have the following error on a win server: "Invalid Top Directory perl/lib/file/find.pm line 598 Here's the code and I'll explain what I found until now: #!/usr/bin/perl # use strict;...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.