Results: 1580
Notes
  • Newest first
  • Oldest first
  • Newest first(All)
  • Oldest first(All)
Output the value of the current element in an array:
$people = ["Peter", "Joe", "Glenn", "Cleveland"];

echo current($people);
by გიორგი ბაკაშვილი
4 years ago
0
PHP
Array
PHP official doc
1
Calculate and return the product of an array:
// Returns product of the array members
echo array_product([5,5]);
by გიორგი ბაკაშვილი
4 years ago
0
PHP
Array
PHP official doc
1
Remove elements from an array and replace it with new elements:
<?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);
?>
by გიორგი ბაკაშვილი
4 years ago
0
PHP
Array
PHP official doc
1
Break a string into an array:
<?php
$str = "Hello world. It's a beautiful day.";
print_r (explode(" ",$str));
?>
by გიორგი ბაკაშვილი
4 years ago
0
PHP
String
PHP official doc
1
Join array elements with a string:
<?php
$arr = array('Hello','World!','Beautiful','Day!');
echo implode(" ",$arr);
?>
by გიორგი ბაკაშვილი
4 years ago
1
PHP
String
PHP official doc
1
Laravel factory
Laravel has a feature called model factories that allows you to build fake data for your models Generate Dummy Users:
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
.
by გიორგი ბაკაშვილი
4 years ago
0
Laravel
Tinker
1
The command below makes Git
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/
by Valeri Tandilashvili
4 years ago
0
Git
1
check if the response JSON includes certain text
Tests that the response JSON includes text:
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"
    }
}
by Valeri Tandilashvili
4 years ago
0
Postman
postman tests
1
check that the response JSON text is equal to the specified text
Tests that the response JSON is equal to the specified text
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
by Valeri Tandilashvili
4 years ago
0
Postman
postman tests
1
Find the position of the first occurrence of "php" inside the string:
<?php
echo strpos("I love php, I love php too!","php");
?>
by გიორგი ბაკაშვილი
4 years ago
0
PHP
String
PHP official doc
1
Results: 1580