convert int to string php
$var = 5;
// Inline variable parsing
echo "I'd like {$var} waffles"; // = "I'd like 5 waffles
// String concatenation
echo "I'd like ".$var." waffles"; // I'd like 5 waffles
// Explicit cast
$items = (string)$var; // $items === "5";
// Function call
$items = strval($var); // $items === "5";
<?php
class StrValTest
{
public function __toString()
{
return __CLASS__;
}
}
// Prints 'StrValTest'
echo strval(new StrValTest);
?>$number = 11;
// This
echo strval($number);
// Or This
echo (String) $number;
// Output
// "11"
// "11"intval ( mixed $var [, int $base = 10 ] ) : intreturn strval($integer);
Also in PHP:
- check substring in php
- exception ph
- check key exists in associative array in php
- execute composer with php version
- To find out where your php.ini is located
- create database seeder in laravel
- Your Composer dependencies require the following PHP extensions to be installed: dom, mbstring, xml, xmlwriter
- 1071 Specified key was too long; max key length is 1000 bytes (SQL: alter table `users` add unique `users_email_unique`(`email`))
- echo ternary php
- encrypt decrypt php
- date inphp
- Illuminate\Contracts\Container\BindingResolutionException Target class [SlugController] does not exist.
- Connect to SQL in a php PDO and print the data in it
- eloquent all only one culomn
- array reverce php
- codeigniter get num_rows
- The key "initial" is not recognized and ignored.
- php random string generator
- array contains key
- age date de naissance php
- current date function in php
- Route [login] not defined.Route [login] not defined.
- custom post type with taxonomy
- create a folder php