Which of the following is an alias for the chop () php function?

(PHP 4, PHP 5, PHP 7, PHP 8)

chopAlias of rtrim()

Description

This function is an alias of: rtrim().

Notes

Note:

chop() is different than the Perl chop() function, which removes the last character in the string.

Kubo2

7 years ago

Rather use rtrim(). Usage of chop() is not very clear nor consistent for people reading the code after you.

JumpIfBelow

7 years ago

If you are searching for a function that does the same trick as chop in PERL, then you should just do the following code:
   $str = substr($str, 0, -1);
?>

The question is: why isn't chop() an alias of the code above, rather than something which will trap developpers?

krkbpk at gmail dot com RamaKrishna Kothamasu

9 years ago

//simple example function for chop()
echo "

";//without 
 you cann't see desired output in your browser
echo chop("   Ramki   ");//right spaces are eliminated
echo chop("Ramkrishna", "a..z");
echo
"
"
;
?>
/*output
  ------
  RamkiR*/

rahuls8730 at gmail dot com

13 years ago

Definition and Usage

The chop() function will remove a white space or other predefined character from the right end of a string.

This function is an alias of the rtrim() function.
Syntax
chop(string,charlist)

Parameter     Description
string     Required. Specifies the string to check
charlist     Optional. Specifies which characters to remove from the string.
The following characters are allowed and is set to be removed if the charlist parameter is empty:

    * "\0" - ASCII 0, NULL
    * "\t" - ASCII 9, a tab
    * "\n" - ASCII 10, a new line
    * "\x0B" - ASCII 11, a vertical tab.
    * "\r" - ASCII 13, a carriage return
    * " " - ASCII 32, an ordinary white space

anon at mailinator dot com

15 years ago

Another possible one would be to use this:

function chup(){$ar=Array();

foreach(

func_get_args() as $b) {push($ar,$b[strlen($b)-1]);

&

$b[strlen($b)-1]='';

  }

return

$ar;

}

?>

If you wanted to perl-chop a va list of strings and return the removed chars. Obviously you can easily mod it for va list arrays of strings and the like.

Upgrade to remove ads

Only SGD 41.99/year

  • Flashcards

  • Learn

  • Test

  • Match

  • Flashcards

  • Learn

  • Test

  • Match

Terms in this set (15)

scalar

What kind of PHP variable stores a single value?

0

PHP indexes start at ________ by default.

$products = ['Tires', 'Oil', 'Spark Plugs'];

Which of the following expressions shows a correct PHP array definition?

first

The statement $products{0} accesses the ________ element in an array.

list

The ________ construct can be used to split an array into a number of values.

!==

Which of the following PHP array operators signifies non-identity?

ksort()

The three different PHP sorting functions are sort(), asort(), and:

multidimensional

An array containing other arrays is known as a(n) ________ array.

from the start and end of a string

The trim() function removes whitespace:

rtrim()

Which of the following is an alias for the chop() PHP function?

>

Which of the following represents the HTML encoding of >?

n12br()

Which PHP function takes a string as a parameter and replaces all the newlines in it with the HTML
tag?

c

Which of the following conversion specification type codes interprets as an integer and prints as a character?

5

What is the result of the statement echo strlen("hello");?

The last character in $test

The expression $test = substr_replace($test, 'X', -1); replaces:

Sets with similar terms

cop 1220

76 terms

quizlette2157204

C programming Test Chapters 7-9

30 terms

ladymolly

c++ final review

59 terms

lin_yifan

COP3014 Midterm

104 terms

gabimetallides

Sets found in the same folder

Chapter 1 & 2 Quiz

7 terms

Alex_Rhine9

Chapter 5 & 6 Quiz

3 terms

Alex_Rhine9

Chapter 7 & 8

15 terms

Alex_Rhine9

Chapter 9 & 10

20 terms

Alex_Rhine9

Other sets by this creator

Chapter 14 & 15

20 terms

Alex_Rhine9

Chapter 13

10 terms

Alex_Rhine9

Java Chapter 7

15 terms

Alex_Rhine9

Chapter 3

22 terms

Alex_Rhine9

Verified questions

COMPUTER SCIENCE

What manages caching in Windows? How is the cache managed?

Verified answer

COMPUTER SCIENCE

Explain the following programming statement in terms of objects and the services they provide: System.out.println ("I gotta be me!");

Verified answer

COMPUTER SCIENCE

Is the array with values ⟨23, 17, 14, 6, 13, 10, 1, 5, 7, 12⟩ a max-heap?

Verified answer

COMPUTER SCIENCE

The decrease count () function in the previous exercise currently returns 0 if sufficient resources are available and −1 otherwise. This leads to awkward programming for a process that wishes to obtain a number of resources: while (decease_count(count) == -1) ; Rewrite the resource-manager code segment using a monitor and condition variables so that the decrease count() function suspends the process until sufficient resources are available. This will allow a process to invoke decrease_count () by simply calling decrease_count (count) ; The process will return from this function call only when sufficient resources are available.

Verified answer

Recommended textbook solutions

Which of the following is an alias for the chop () php function?

Service Management: Operations, Strategy, and Information Technology

7th EditionJames Fitzsimmons, Mona Fitzsimmons

103 solutions

Which of the following is an alias for the chop () php function?

Information Technology Project Management: Providing Measurable Organizational Value

5th EditionJack T. Marchewka

346 solutions

Which of the following is an alias for the chop () php function?

Service Management: Operations, Strategy, and Information Technology

7th EditionJames Fitzsimmons, Mona Fitzsimmons

103 solutions

Which of the following is an alias for the chop () php function?

Information Technology Project Management: Providing Measurable Organizational Value

5th EditionJack T. Marchewka

346 solutions

Other Quizlet sets

COB300 - Management Exam 2 Ch. 8, 9, 12, 13, 14

222 terms

laurenjones211

Econ Ch. 14 Section 1

30 terms

MCMILLER111PLUS

2 heart failure with preserved LV ejection functio…

14 terms

Tien2017

Clincal Seminar 2 concepts review

288 terms

Zachp8854

Related questions

QUESTION

When closing the Pocket PC emulator, it is important to save the emulator state to ensure the proper functioning of the code when run again after changes have been made.

2 answers

QUESTION

The precision modifier can specify the number of digits to display on both sides of the decimal-point with a floating-point value.

15 answers

QUESTION

Dylan is working on software that he wants to run on a laptop, a smartphone, and a video game console. Which programming language would be the BEST choice for this software?

5 answers

QUESTION

T/F: Swift provides two special types: Any and AnyObject. Any, as the name implies, can represent an instance of any type: strings, doubles, functions, or whatever. AnyObject can represent any class within Swift, but not a structure.

2 answers

What is chop function in PHP?

The chop() function removes whitespaces or other predefined characters from the right end of a string.

Which PHP function takes a string as a parameter and replaces all the newlines in it with the HTML?

The str_replace() function is an inbuilt function in PHP which is used to replace all the occurrences of the search string or array of search strings by replacement string or array of replacement strings in the given string or array respectively.

What is the role of foo in the PHP statement function (' foo ');?

Foo (pronounced FOO) is a term used by programmers as a placeholder for a value that can change, depending on conditions or on information passed to the program. Foo and other words like it are formally known as metasyntactic variables.

What is Rtrim PHP?

The rtrim() function removes whitespace or other predefined characters from the right side of a string. Related functions: ltrim() - Removes whitespace or other predefined characters from the left side of a string.