Il 0% ha trovato utile questo documento (0 voti)
20 visualizzazioni13 pagine

PHP Set 2

Dgxysv

Caricato da

sushanttandale6
Copyright
© © All Rights Reserved
Per noi i diritti sui contenuti sono una cosa seria. Se sospetti che questo contenuto sia tuo, rivendicalo qui.
Formati disponibili
Scarica in formato PDF o leggi online su Scribd
Il 0% ha trovato utile questo documento (0 voti)
20 visualizzazioni13 pagine

PHP Set 2

Dgxysv

Caricato da

sushanttandale6
Copyright
© © All Rights Reserved
Per noi i diritti sui contenuti sono una cosa seria. Se sospetti che questo contenuto sia tuo, rivendicalo qui.
Formati disponibili
Scarica in formato PDF o leggi online su Scribd
Sei sulla pagina 1/ 13
|Features of PHP Some unique features of PHP are as follows:. Performance: Scripts written in PHP executes faster than other scripting languages like JSP, ASP. NET and Perl. PHP designed to improve performance through optimized memory, also third party applications are available which improves the response time. Portability: PHP is available for Windows, Unix, MAC OS and 0S/2 .So PHP programs are portable between platforms) Portability means program written on windows can execute on Unix without any changes. Ease of use: It is extremely sophisticated programming language, its syntax is very clear and consistent. Thats why programmers can easily read the code and that why it is favored for web based applications. Open source: PHP is an open source project that means this language is developed by a worldwide team of volunteers who make its source code freely available. So there is no licensing fees required. This is an important factor for reducing software development cost. Also it makes robust because any developer can suggest changes in the source code of language and it can be added as per guidelines. litle Sure, here's a simple PHP script to find the sum of digits of a number: For loop + This type of loop is used when the user knows in advance, how many times the block needs to execute. It means the number of interactions is known beforehand. Examole:- "; } ?> 2)For each loop + For each statement allows you to iterate over elements in an array. With indexed array, the values at each key can be accessed as follows: Example:- " $arr= array("Ritika","atharva","shailesh"); > 854 BOOM + BS oul! ull © 40% xX Vv 9g ChatGPT ge chatgpt.com ChatGPT 3.5 v G You d) Explain cookies in php. @ ChatGPT In PHP, cookies are small pieces of data sent from a website and stored on the user's computer by the user's web browser while the user is browsing. They can be used for various purposes such as session management, user authentication, tracking user activity, and personalization. Cookies in PHP can be set, retrieved, and manipulated using built-in functions like *setcookie()~ and *$_COOKIE *. They have parameters like name, value, expiration time, domain, and path, allowing developers to control their behavior. wmaoe? Message ChatGPT ChatGPT can make mistakes. Consider checking important information, = 0 J Built-in Functions of Array e In chaptert, we hi manipulations. a ave learned many built-in functions provided by PHP for array Table 3.6: Commonly used PHP array functions Function Function What It Does explode() Splits a string into array elements implode() Joins array elements into a string range() Generates a number range as an array min() Finds the smallest value in an array max() Finds the largest value in an array shuffle() Randomly rearranges the sequence of elements in an array array_slice() Extracts a segment of an array array_shift() Removes an element from the beginning of an array array_unshift() Adds an element to the beginning of an array array_pop() Removes an element from the end of an array array_push() Adds an element to the end of an array array_unique() Removes duplicate elements from an array | array_reverse() Reverses the sequence of elements in an array array_merge() Combines two or more arrays array_intersect() Calculates the common elements between two or more arrays array diff() Calculates the difference between two arrays in_array() Checks ifa particular value exists in an array 857 BOOM + Faull atl 359% € A € 8 Title Q2 a) Write a php script to display table of a number? Multiplication Table of $number:"; echo ""; for ($i = 1; $i <= $limit; $i++) { echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
$numberx$i=". ($number * $i) . "
"; } // Usage example: display table of number 5 $number = 5; displayMultiplicationTable($number); > & 9 [> wt Built-in Functions for Em pty String 1 empty( ): The empty( ) function returns true if a string variable is “empty.” EMPtY string variables are those with the values", 0,0’, or NULL. This function also returns true when used with a non-existent variable. Syntax: boolean empty(string) Program 3.10: Program for empty( ) function. "; $str = null; echo (boolean) empty($str) ="
"5 $str = '0'; echo (boolean) enpty($str) ."
"; unset($str); echo (boolean)empty($str) ."
"; 2> Output: True True True True Built-in Function for Reversing and Repeating Strings 1. strlen(): This function returns the number of characters ina string. Syntax: integer strlen(string) Program 3.11: Program for strlen() function. Output: The Length of the string is: 14 3.10 c) Write a code in php which accepts two strings from user and displays them after concatenation. String Concatenation

String Concatenation

">

Potrebbero piacerti anche