3

@3373_vaishnavi

Array call to string

PHP
1 year ago
<?php $country=array("Maharashtra","Tamilnadu","Sikkim","uttarakhand"); echo$country[0]; ?>

Area of rectangle

PHP
1 year ago
<?php $length =25; $breadth=10; echo "ara of rectangle=",($length*$breadth); ?>

Cloning of object in 3/4m

PHP
1 year ago
<?php class Car{ public $model; public $owner; public function __construct($model,$owner){ $this->model=$model; $this->owner=$owner; } public function __clone(){

Fun overloading in php ex :

PHP
1 year ago
<?php function display (){ $args=func_get_args(); switch (count($args)){ case 1: echo"one argument:".$args[0]."\n"; break; case 2: echo "two arguments:".$args[0]."and".$args[1]."\n"; break;

Class ex.in 3m php

PHP
1 year ago
<?php class Dog { public $name; public function __construct($name) { $this->name = $name; } public function bark() { echo "Woof! My name is " . $this->name;

W.A.P.Timestamp EX.PHP

PHP
1 year ago
<?php // Get the current timestamp $timestamp = time(); // Display the timestamp echo "Current Timestamp: " . $timestamp; // Optionally, display the current date and time in a readable format echo "<br>Current Date and Time: " . date("Y-m-d H:i:s", $timestamp); ?>

Remove & delete array

PHP
1 year ago
<?php $array =[1,2,3]; unset ($array);

Strtoupper()Ex.string fun

PHP
1 year ago
<?php $text = "hello php"; $upperText = strtoupper($text); echo $upperText; ?>

Str_len() string

PHP
1 year ago
<?php $text = "Hello PHP"; $length = strlen($text); echo $length; ?>

ucwords() Ex.in string fun

PHP
1 year ago
<?php $text = "hello world from php"; $capitalizedText = ucwords($text); echo $capitalizedText; ?>

Str_replace() ex. string fun

PHP
1 year ago
<?php $text = "Hello world!"; $replacedText = str_replace("world", "PHP", $text); echo $replacedText; ?>

Syntax:- str_word_count

PHP
1 year ago
<?php $strings="Hello,How are you today?" $word_count= str_word_count($strings); echo$wordcount; ?>

Ex.user defined function in php 4m

PHP
1 year ago
<?php function workers ($employee){ echo"Hello,$employee"; } workers("jaya"); ?>

Multiply 2 integer

PHP
1 year ago
<?php $a =50; $b =100; $c=$a*$b; echo "multiply two integer=",$c; ?>

Object syntax 2m

PHP
1 year ago
<?php // Creating an object $object = new stdClass(); // Property added to the object $object->property = 'Property_value'; ?>

Object

PHP
1 year ago
<?php // Create an Object $object = new stdClass(); $object->name = 'sai'; $object->address = 'pune'; print_r($object);

Calculate the area of rectangle

PHP
1 year ago
<?php $length=10; $width=5; $area=$length*$width; echo ("area of rectangle=".$area); ?>

String fun (4)substr()

PHP
1 year ago
<?php $string="Hello world"; $substring=substr($string,7,5); echo$substring; ?>

String fun (3)strpos()

PHP
1 year ago
<?php $string="Hello world"; $position=strpos($string,"world"); echo$position; ?>

String fun(2)str_replace

PHP
1 year ago
<?php $string="Hi Indian"; $newstring=str_replace("Indian","MH",$string); echo$newstring; ?>