$people = ["Peter", "Joe", "Glenn", "Cleveland"];
echo current($people);
// Returns product of the array members
echo array_product([5,5]);
<?php
$a1=array("a"=>"red","b"=>"green","c"=>"blue","d"=>"yellow");
$a2=array("a"=>"purple","b"=>"orange");
array_splice($a1,0,2,$a2);
print_r($a1);
?>
<?php
$str = "Hello world. It's a beautiful day.";
print_r (explode(" ",$str));
?>
<?php
$arr = array('Hello','World!','Beautiful','Day!');
echo implode(" ",$arr);
?>
laravel 8 version
php artisan tinker
User::factory()->count(5)->create()
laravel 6, 7 version
php artisan tinker
factory(App\User::class,5)->create();
This by default created factory of laravel. you can also see that on following url: database/factories/UserFactory.php
.forget
about test.php
that was tracked but is now in .gitignore
git rm --cached test.php
The command makes Git forget
about all files under docs
directory that was tracked but is now in .gitignore
git rm -r --cached docs/
Mobile Number
pm.test("Body matches string", function () {
pm.expect(pm.response.text()).to.include("Mobile Number");
});
The response JSON{
"status": {
"code": 400,
"text": "Mobile Number is required"
}
}
pm.test("Body is correct", function () {
pm.response.to.have.body('{"status":{"code":400,"text":"Mobile Number is required"}}');
});
The response JSON{
"status": {
"code": 400,
"text": "Mobile Number is required"
}
}
The test returns true
because the text passed to the test is the same as the response JSON<?php
echo strpos("I love php, I love php too!","php");
?>