473,322 Members | 1,403 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,322 software developers and data experts.

Could this be a PHP 4.3.6 "feature"?

[PHP]
echo "val = $val<P>";
list($mySection, $myDisplay) = explode('|', $val);
echo "mySection = $mySection and myDisplay = $myDisplay<P>";
[/PHP]

In using PHP 4.3.6 here are my results:

val = image|Image Maintenance

mySection = image and myDisplay = image
I narrowed down the problem to this:

[PHP]
$blahArray = explode('|', $val);
print_r($blahArray);
$blahArray = split('|', $val);
print_r($blahArray);
[/PHP]

Nothing prints out, the array $blahArray is never set, not even to an
empty array. No error messages nor warnings result in this.

Has anyone had any similar problems with PHP 4.3.6 or am I just the
"lucky one"? If so, is this an undocumented bug in 4.3.6 (all I could
find in www.php.net was that there was a negative limit to explode()
).

I am unable myself to bounce the webserver as I do not have [yet] the
privileges to do so to figure if that might be a requirement, so until
the system admins have the time to do so (takes a minute *sigh*) I am
trying to cover all possible angles to this rather wacky problem.

Phil
Jul 17 '05 #1
3 2959
"Phil Powell" <so*****@erols.com> wrote in message
news:1c**************************@posting.google.c om...
[PHP]
echo "val = $val<P>";
list($mySection, $myDisplay) = explode('|', $val);
echo "mySection = $mySection and myDisplay = $myDisplay<P>";
[/PHP]


hmm.. it would sound very strange that such bug exists. Just to be sure that
there are no funny things in $val, could you try this snippet:

[PHP]
$val = "image|Image Maintenance";
echo "val = $val<P>";
list($mySection, $myDisplay) = explode('|', $val);
echo "mySection = $mySection and myDisplay = $myDisplay<P>";
[/PHP]

rush
--
http://www.templatetamer.com/
Jul 17 '05 #2
On Mon, 26 Jul 2004 09:15:54 -0700, Phil Powell wrote:
I narrowed down the problem to this:

[PHP]
$blahArray = explode('|', $val);
print_r($blahArray);
$blahArray = split('|', $val);
print_r($blahArray);
[/PHP]

Nothing prints out, the array $blahArray is never set, not even to an
empty array. No error messages nor warnings result in this.


For me (although I must admit, I am running PHP 4.3.7), the OP code, when
converted to "real" PHP code as follows, works for me:

<!-- ====================== -->
<pre>
<?
$val = "image|Image Maintenance";
$blahArray = explode('|', $val);
print_r($blahArray);
$blahArray = split('|', $val);
print_r($blahArray);
?>
</pre>
<!-- ====================== -->

(<pre> tags just there to help with formatting the output)

But I do get an error:

Warning: split(): REG_EMPTY in /home/jeff/public_html/testsplit.php on
line 13

That is the last line, with the split() func. But to fix that, split
needs regex delimiters like so:

$blahArray = split('/|/', $val);

(Note the slashes "/" around the pipe)
later...
--
Jeffrey D. Silverman | je**********@jhu.edu **
Website | http://www.newtnotes.com

(** Drop "pants" to reply by email)

Jul 17 '05 #3
On Mon, 26 Jul 2004 15:43:49 -0400, Jeffrey Silverman wrote:
That is the last line, with the split() func. But to fix that, split
needs regex delimiters like so:

$blahArray = split('/|/', $val);

(Note the slashes "/" around the pipe)


Ooops!! I spoke wrongly about split()!

You need to ESCAPE the pipe with a backslash in split(), NOT provide regex
delimiters!

Corrected code:
$blahArray = split('\|', $val);
later...

--
Jeffrey D. Silverman | je**********@jhu.edu **
Website | http://www.newtnotes.com

(** Drop "pants" to reply by email)

Jul 17 '05 #4

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

Similar topics

10
by: Carlos Ribeiro | last post by:
Hello all. I'm sending this to the list because I would like to know if someone else has ever stumbled across this one, and also because one possible solution is to patch, or simply "decorate",...
15
by: Jordan Rastrick | last post by:
First, a disclaimer. I am a second year Maths and Computer Science undergraduate, and this is my first time ever on Usenet (I guess I'm part of the http generation). On top of that, I have been...
1
by: Tobias | last post by:
Need help: In Visual C++ 6 there was a feature "function called by" which could be reached by right-mouse-button-clicking on a function in the class view. I can't find the feature in .NET. Does it...
3
by: laredotornado | last post by:
Hello, I have a simple login script. I have the pages login.php login_response.php login_success.php login_failure.php What I want to do is have a checkbox on the login.php page where if...
2
by: google | last post by:
Hello everyone, I am having an issue using the "Multi Select" option in a list box in MS Access 2003. I am making a form that users can fill out to add an issue to the database. Each issue can...
38
by: looping | last post by:
For Python developers around. >From Python 2.5 doc: The list of base classes in a class definition can now be empty. As an example, this is now legal: class C(): pass nice but why this...
1
by: Bradley Burton | last post by:
My friend has made a webpage that's kind of like myspace. He wants to make a feature similiar to the 'tag a photo' feature that's in facebook. This feature allows a person to upload a pic which...
4
by: Jean-Fabrice RABAUTE | last post by:
Hi, I am happy to announce the release of the Companion.JS v0.2, an alpha version to a Javascript debugger for IE : http://www.my-debugbar.com/wiki/CompanionJS/HomePage The main new feature...
1
by: mohini2000 | last post by:
Hi I want to implement a "Remember Me" feature in a website that basically keeps users logged into the website, even after they've closed the browser so that the next time they come, they won't...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.