Jump to content

malikye

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

malikye's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. MasterACE14, Thank you so much!!!
  2. i'm trying to learn how to make an array. the user will type in a text box, and i want them to receive a "Yes" or "No" if what they type matches my array. but for some reason, my answer is always "No". here is my code: <?php $qual=array('html','web','graphic','SQL'); ?> <?php if ($qualification==$qual) echo "Yes"; else echo "No"; ?> what am i doing wrong?
  3. Thanks! i tested my code and your code, and i will add the $ sign. i thought the ",3" i put at the end of the code told it to look at the last 3 characters.
  4. after playing around with the code, i came up with this solution: <?php echo preg_replace('/son/', '<i>son</i>',(preg_replace('/e/', '<u>e</u>',(str_replace("s","5",$fname)), 1)), 3); ?> I'm sure there is a "cleaner" way to do that, but this works just fine. Thank you, scootstah.
  5. is there anyway i can get both those codes to work for $fname at once without another line of code? geez, i hope that question made sense.
  6. scootstah, thank you so much for pointing me to preg_replace. that worked perfectly. here's my code: <?php echo preg_replace('/e/', '<u>e</u>', $fname, 1); ?> i assume that should work for underlining "son" also. i will give that a try. update: here is my code for changing "son" if it's the last 3 letters in the name: <?php echo preg_replace('/son/', '<i>son</i>', $fname, 3); ?> thank you for your help!
  7. thanks scootstah, this isn't really homework - Im 27 years old and not in school anymore. i won't be graded on this project. but i am trying to learn PHP. i have tried the strpos function - i learned it from w3schools.com. according to w3schools: "The strpos() function returns the position of the first occurrence of a string inside another string." - and the example they have is basically returning the position that the string is in. so that example returned "6", but what i am trying to figure out is, how do i make changes to the output because i want to underline the first letter "e" from the form. thanks for your help. i understand you don't want to help because your worried if someone might be cheating on a homework assignment.
  8. Hello, I am very new to PHP. I am working on a project (just an exercise) and I am stump on one of the exercise: Create a self-submitting form page that accepts the user’s first and last name in 2 text boxes. - On submission, your script should replace all instances of the letter “s” with the number “5”, determines the location of the first “e” (if one exists), and evaluates whether the last 3 characters of the last name are “son”. - The modified text should be displayed on the page after submission with the first “e” underlined and the last 3 characters in italics ONLY if they are “son”. I am able to figure out the first part with replacing "s" with "5" (I'm very proud of myself for that) but the other parts is what i am stuck on. to find the first "e", i assume I would use a If Then statement and a Left Function, but from there, I don't know how I get it to "echo" an underline "e". same goes for the last part of the exercise. I assume i would use a Right Function. Any help would be greatly appreciated. Thank you, Malikye
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.