Online Programming Tutorials | Web Tutorials | PHP Tutorials

Python String encode() Method

The Python string encode() method encodes the subject string with a provided encoding method as an argument. If no method is not provided, the UTF-8 is used as the default encoding. Read More

Python String endswith() Method

The endswith() method is used when checking whether a substring is equal to the suffix of the string. This method takes a string that will be compared against the suffix of the other string. This method can take two additional arguments. One is the start, and the other is the end. These specify the starting and ending index of the suffix, of which the method will compare the substring. Read More

Python String expandtabs() Method

Expands tabs in a string by replacing the tab with the number of spaces specified by tab size. The function defaults to 8 spaces per tab when tab size isn't provided. This method converts all the tab characters(\t) with whitespaces. The number of whitespaces used depends upon the value of the argument tab size. The number of whitespaces to be used is the difference between the current position and the next stopping position(a multiple of tab size). Read More

Python String casefold() Method

The Python casefold() function works as a stronger version of Python’s lower() function, i.e. it has the same functionality of returning a lowercased copy of the given string, but it takes the method one step further by being more aggressive, which is shown by its lowercasing of character beyond the ASCII accepted characters. It even ignores the case of the given string, making it preferable to handle caseless string matching. Read More

Python String find() Method

The Python find() method searches the given string argument in the subject string and returns the lowest index position of the occurrence of the string within another string. Read More

Converting List to String in Python

Here, I will discuss how a list can be converted to a string in Python. Python has many ways of converting a list data type to a string data type of Python. A straightforward method will be to iterate through the list and concatenate each element to an empty string. First, you have to create a List, then an empty string to store the List values. Each element of the list is accessed through For loop and appended to the string using the += operator. Finally, the string is printed. Read More

PHP Break statement

The PHP break statement is used to end a loop prematurely by inserting the break keyword inside a conditional statement. As the interpreter finds the break, it terminates the loop, and execution is passed to code next to the current loop. The break statement works for all the PHP loops, i.e., Do..while, while, for loop, foreach loop, etc. Read More

PHP Continue Statement

When we want to skip to the next iteration of the loop that is currently being executed, we use the continue statement. Thus, whenever the control reaches the continue statement, the loop being executed skips the current iteration, and the control goes to the following iteration. Read More

PHP Cookie

The Cookie is a set of information saved by the website script on the user's computer. Cookie data is automatically sent to the server with the request's header whenever a user visits a page. The server sends data to the browser, and the browser saves them into a temporary file on the computer's hard disk. The data even persists when the user's computer is switched off. A cookie is ideal for storing small amounts of data on a user's computer. It is not for storing a large amount of user data or keeping sensitive information. Read More

PHP Sessions

The session is another way of storing the user's temporary data on the server. Unlike cookies, the session stores data on the server with a short session ID string with the data. The server sends a cookie with the string ID to the browser in response to a request. When the browser requests a page from the website, the cookie with string ID goes back to the server, and then your PHP script can access the session data. As a developer, you specifically store the user's information on the database server to use them later in your application, but sometimes you need temporary data fields to send across the website's pages, and one way of saving temporary data is the cookie discussed in an earlier tutorial. Read More

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies Find out more here