hi all and Happy Thanksgiving to everyone
Can anyone tell me why this script stops at:
echo "<p>" . lcfirst($UppercaseText) . "</p>\n";
<?php
$StartingText = "mAdAm, i'M aDaM.";
$UppercaseText = strtoupper($StartingText);
$LowercaseText = strtolower($StartingText);
echo "<p>$UppercaseText</p>\n";
echo "<p>$LowercaseText</p>\n";
echo "<p>" . ucfirst($LowercaseText) . "</p>\n";
echo "<p>" . lcfirst($UppercaseText) . "</p>\n";
$WorkingText = ucwords($LowercaseText);
echo "<p>$WorkingText</p>\n";
echo "<p>" . md5($WorkingText) . "</p>\n";
echo "<p>" . substr($WorkingText,0.6) . "</p>\n";
echo "<p>" . substr($WorkingText,7) . "</p>\n";
echo "<p>" . strrev($WorkingText) . "</p>\n";
echo "<p>" . str_shuffle($WorkingText3) . "</p>\n"
?>
Thanks in advance
Script stopping before it should
Started by dcord, Nov 25 2010 05:28 AM
7 replies to this topic
#1
Posted 25 November 2010 - 05:28 AM
|
|
|
#2
Posted 25 November 2010 - 05:43 AM
Hello dcord, it stops actually at this line:
You reference to the variable $WorkingText3 but that does not exist.
echo "<p>" . str_shuffle($WorkingText3) . "</p>\n"
You reference to the variable $WorkingText3 but that does not exist.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
#3
Posted 25 November 2010 - 05:55 AM
before I added the lines:
echo "<p>" . md5($WorkingText) . "</p>\n";
echo "<p>" . substr($WorkingText,0.6) . "</p>\n";
echo "<p>" . substr($WorkingText,7) . "</p>\n";
echo "<p>" . strrev($WorkingText) . "</p>\n";
echo "<p>" . str_shuffle($WorkingText3) . "</p>\n"
it would only take me to the 3rd echo statment
after adding the above lines it only echoed back to the third echo statement.
are you saying you ran the script and got a different result? or can you tell by looking at it?
this code was copied directly from a text book trying to teach us how to Modify the case of a string.
I'ts hard to believe that a text book would have the code incorrect. but it wouldnt surprise me.
The $WorkingText is declared and referenced with the echo statement below it. or am I wrong about that?
thanks for your time
echo "<p>" . md5($WorkingText) . "</p>\n";
echo "<p>" . substr($WorkingText,0.6) . "</p>\n";
echo "<p>" . substr($WorkingText,7) . "</p>\n";
echo "<p>" . strrev($WorkingText) . "</p>\n";
echo "<p>" . str_shuffle($WorkingText3) . "</p>\n"
it would only take me to the 3rd echo statment
after adding the above lines it only echoed back to the third echo statement.
are you saying you ran the script and got a different result? or can you tell by looking at it?
this code was copied directly from a text book trying to teach us how to Modify the case of a string.
I'ts hard to believe that a text book would have the code incorrect. but it wouldnt surprise me.
The $WorkingText is declared and referenced with the echo statement below it. or am I wrong about that?
thanks for your time
#4
Posted 25 November 2010 - 06:01 AM
dcord, I have just tested your code on my server and it works correctly. Check your server properties.
#5
Posted 25 November 2010 - 06:02 AM
here is what I get from my script. I upload it to my server and view it in a IE web brow
MADAM, I'M ADAM.
madam, i'm adam.
Madam, i'm adam.
then it stops
MADAM, I'M ADAM.
madam, i'm adam.
Madam, i'm adam.
then it stops
#6
Posted 25 November 2010 - 06:13 AM
Ah, it turns out lcfirst only exists in PHP 5.3.0+, you are likely using an older version and it is not available to you.
You can turn error reporting on and it should tell you that the function does not exist, try this at the beginning of your script:
You can turn error reporting on and it should tell you that the function does not exist, try this at the beginning of your script:
error_reporting(E_ALL);
ini_set('display_errors', 1);
You can better see why yourself with that.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
#7
Posted 25 November 2010 - 07:43 AM
Sorry I am not getting any error returns everything stays the same.
here is a stupid question for you.
How do I check which version I am running?
and what should my server settings be?
I am just using notepad++ to write my code, uploading ftp to my college and then viewing in a web browser
here is a stupid question for you.
How do I check which version I am running?
and what should my server settings be?
I am just using notepad++ to write my code, uploading ftp to my college and then viewing in a web browser
#8
Posted 25 November 2010 - 08:17 AM
You can find out like this:
It is best to know a little more about your system to debug these problems.
echo 'Current PHP version: ' . phpversion();
It is best to know a little more about your system to debug these problems.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.


Sign In
Create Account


Back to top









