PHP Imagechar() FunctionImagechar ( ) function is another inbuilt PHP function mainly used to draw a horizontal character. The function works using the x and y-axis, used to set coordinates for the starting point from where the picture has to be drawn. The origin coordinates ( 0, 0 ) are in the browsing window's top-left corner. We can set the coordinates accordingly from the origin to get the resulting picture according to our needs. Syntax
The image char( ) function returns TRUE on successful execution of the program and FALSE on a failed attempt. Examples of imagechar( ) FunctionExample 1: PHP program to display the basic use of imagechar( ) function Output The above PHP code gives the following output: Here in this program, we have declared various variables like $image to define the size of the image that we require, $background color to define the color of background we require, $text color to define the color of text we require. We have used the string ( ) function to declare the string we want to display as an image. To display the output of the image, we have used an inbuilt PHP command header and imagepng to display on the browser. Example 2: PHP program to display the use of imagechar( ) function Output The above code gives the following output. Here in this program, we have declared various variables like $image to define the size of the image that we require, $background color to define the color of background we require, $text color to define the color of text we require. We have used the image string ( ) function to declare the string we want to display as an image. To display the output of the image, we have used an inbuilt PHP command header and imagepng to display on the browser. Example 3: PHP program to display the use of imagechar( ) function Output The above PHP code gives the following output. Here in this program, we have declared various variables like $image to define the size of the image that we require, $background color to define the color of background we require, $text color to define the color of text we require. We have used the image string ( ) function to declare the string we want to display as an image. To display the output of the image, we have used an inbuilt PHP command header and imagepng to display on the browser. Example 4: PHP program to display the use of imagechar( ) function Output This code gives the following output. Here in this program, we have declared various variables like $image to define the size of the image that we require, $background color to define the color of background we require, $text color to define the color of text we require. We have used the image string ( ) function with a for loop to declare the complete string we want to display as an image. To display the output of the image, we have used an inbuilt PHP command header and imagepng to display on the browser.
Next Topic#
|